Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Deprecate module pattern (factory) components #15145
This is part of reactjs/rfcs#107 but it's not the only reason we want to deprecate it.
It requires a fairly complex code path in React that is forked from how class components are initialized. It makes function components slower, adds code bloat to React and is a maintenance burden.
However, since then when we ultimately supported both ES classes (must be called with
In practice, I don't think this pattern has been widely used even by compile to JS languages or class-like abstractions.
In any official capacity, its support has only been briefly noted at the bottom of the React v0.13.0 Beta 1 post.
It is currently used by at least Relay Classic so some libraries will need to upgrade.
A neat trick is that you can almost always just add:
Foo.prototype = React.Component.prototype;
This tricks React's class detection into thinking it's a class and we'll call it with
ReactDOM: size: 0.0%, gzip: -0.0%
Details of bundled changes.