{"repo":"reactjs/react-lifecycles-compat","free":true,"listed":false,"github":"https://github.com/reactjs/react-lifecycles-compat","clone":"git clone https://github.com/reactjs/react-lifecycles-compat.git","description":"Backwards compatibility polyfill for React class components","language":"JavaScript","stars":459,"topics":["react","polyfill","api","compatibility"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"react-lifecycles-compat What is this project? React version 17 will deprecate several of the class component API lifecycles: componentWillMount , componentWillReceiveProps , and componentWillUpdate . (Read the Update on Async rendering blog post to learn more about why.) A couple of new lifecycles are also being added to better support async rendering mode. Typically, this type of change would require third party libraries to release a new major version in order to adhere to semver. However, the react-lifecycles-compat polyfill offers a way to use the new lifecycles with older versions of React as well (0.14.9+) so no breaking release is required. This enables shared libraries to support both older and newer versions of React simultaneously. How can I use the polyfill First, install the polyfill from NPM: Next, update your component and replace any of the deprecated lifecycles with new ones introduced with React 16.3. (Refer to the React docs for examples of how to use the new lifecycles.) Lastly, use the polyfill to make the new lifecycles work with older versions of React: Which lifecycles are supported? Currently, this polyfill supports static getDerivedStateFromProps and getSnapshotBeforeUpdate - both introduced in version 16.3. Validation Note that in order for the polyfill to work, none of the following lifecycles can be defined by your component: componentWillMount , componentWillReceiveProps , or componentWillUpdate . Note also that if your component contains getSnaps","default_branch":null,"files":null,"tree":[],"storefront":"/r/reactjs","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/reactjs/react-lifecycles-compat/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}