From 14af9531a0d29fa5a8073ea38eb624c207591ba6 Mon Sep 17 00:00:00 2001 From: Marcel Kooi <1marcelkooi@gmail.com> Date: Mon, 13 Apr 2020 17:23:40 -0400 Subject: [PATCH] Moved class component outside forwardRef function --- lib/index.js | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/index.js b/lib/index.js index b969c93..02edf32 100644 --- a/lib/index.js +++ b/lib/index.js @@ -136,34 +136,34 @@ ActionCableController.propTypes = { children: PropTypes.any } -var ActionCableConsumer = React.forwardRef(function (props, ref) { - var Component = createReactClass({ - render: function () { - return React.createElement(Consumer, null, ({ cable }) => { - return React.createElement( - ActionCableController, - { - cable, - ...this.props, - ref: this.props.forwardedRef - }, - this.props.children || null - ) - }) - } - }) +var Component = createReactClass({ + render: function () { + return React.createElement(Consumer, null, ({ cable }) => { + return React.createElement( + ActionCableController, + { + cable, + ...this.props, + ref: this.props.forwardedRef + }, + this.props.children || null + ) + }) + } +}); - Component.displayName = "ActionCableConsumer" +Component.displayName = "ActionCableConsumer" - Component.propTypes = { - onReceived: PropTypes.func, - onInitialized: PropTypes.func, - onConnected: PropTypes.func, - onDisconnected: PropTypes.func, - onRejected: PropTypes.func, - children: PropTypes.any - } +Component.propTypes = { + onReceived: PropTypes.func, + onInitialized: PropTypes.func, + onConnected: PropTypes.func, + onDisconnected: PropTypes.func, + onRejected: PropTypes.func, + children: PropTypes.any +} +var ActionCableConsumer = React.forwardRef(function (props, ref) { return React.createElement( Component, {