Skip to content

Commit ffbe17b

Browse files
sebmarkbagefacebook-github-bot
authored andcommitted
Trick React into thinking a container is a class
Summary: The factory component pattern is about to be deprecate in: facebook/react#15145 This change makes it so that React will call this constructor with `new` as if it is a class component instead of just calling it as a function component. There might be a slight perf penalty to doing this my understanding is that this is not the preferred path anyway. Reviewed By: kassens Differential Revision: D14516681 fbshipit-source-id: 751890a98639687b208633f2e4c8e71e5df60776
1 parent 47d676d commit ffbe17b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/react-relay/buildReactRelayContainer.js

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ function buildReactRelayContainer<TBase: React$ComponentType<*>>(
7171
// $FlowFixMe
7272
return new Container(props);
7373
}
74+
ContainerConstructor.prototype = React.Component.prototype;
7475

7576
function forwardRef(props, ref) {
7677
const context = readContext(ReactRelayContext);

0 commit comments

Comments
 (0)