Implement the experimental Hooks proposal behind a feature flag #13968
Hooks let you use all React features (such as state and lifecycle) without writing a class.
We have presented the Hooks proposal at React Conf 2018. This pull request implements all proposed built-in Hooks behind a feature flag, both for the client and the server renderer.
This is a very early time for Hooks and this proposal is experimental. We're merging it into master now so we can iterate on it. It is turned on only in the 16.7 alpha release so that you can try it and provide your feedback.
We have been using this code for a month in production so while the APIs are not stable, we don't expect the implementation to contain major bugs.
Please keep the feedback and discussion contained in the Hooks RFC (and not in this PR) so that everyone can discuss it in a single place without checking multiple GitHub threads.
Details of bundled changes.
Effects scheduled by useEffect should not fire until after the browser has had a chance to paint. However, they should be fired before any subsequent mutations. Also adds useMutationEffect and useLayoutEffect. useMutationEffect fires during the host update phase. useLayoutEffect fires during the post- update phase (the same phase as componentDidMount and componentDidUpdate).