Skip to content

Commit 37d46dd

Browse files
committed
review tweaks
1 parent d15ec6e commit 37d46dd

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

content/blog/2019-02-04-react-v16.8.0.md

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,43 @@ Note that **to enable Hooks, all React packages need to be 16.8.0 or higher**. H
3838

3939
## Tooling Support
4040

41-
React Hooks are now fully supported by React DevTools. They are also supported in the latest Flow and TypeScript definitions for React. We recommend using a new [lint rule](https://www.npmjs.com/package/eslint-plugin-react-hooks) to enforce best practices with Hooks. It will soon be included into Create React App by default.
41+
React Hooks are now fully supported by React DevTools. They are also supported in the latest Flow and TypeScript definitions for React. We strongly recommend enabling a new [lint rule called `eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) to enforce best practices with Hooks. It will soon be included into Create React App by default.
4242

4343
## What's Next
4444

4545
We described our plan for the next months in the recently published [React Roadmap](/blog/2018/11/27/react-16-roadmap.html).
4646

4747
Note that React Hooks don't cover *all* use cases for classes yet but they're [very close](/docs/hooks-faq.html#do-hooks-cover-all-use-cases-for-classes). Currently, only `getSnapshotBeforeUpdate()` and `componentDidCatch()` methods don't have equivalent Hooks APIs, and these lifecycles are relatively uncommon. If you want, you should be able to use Hooks in most of the new code you're writing.
4848

49-
Even while Hooks were in alpha, we saw many [interesting examples](https://medium.com/@drcmda/hooks-in-react-spring-a-tutorial-c6c436ad7ee4) of custom Hooks for animations, forms, subscriptions, integrating with other libraries, and so on. Our goal is to empower the React community to write components and Hooks that deliver great user and developer experience. We can't wait to see what you'll create next!
49+
Even while Hooks were in alpha, we saw many [interesting examples](https://medium.com/@drcmda/hooks-in-react-spring-a-tutorial-c6c436ad7ee4) of custom Hooks for animations, forms, subscriptions, integrating with other libraries, and so on. We're excited about Hooks because they make code reuse easier, helping you write your components in a simpler way and make great user experiences. We can't wait to see what you'll create next!
5050

5151
## Thanks
5252

5353
We'd like to thank everybody who commented on the [Hooks RFC](https://github.com/reactjs/rfcs/pull/68) for sharing their feedback. We've read all of your comments and made some adjustments to the final API based on them.
5454

55+
## Breaking Changes from Alpha Versions
56+
57+
React 16.8.0 is the first **stable** release supporting Hooks.
58+
59+
Over the past few months, we have also provided several **alpha** versions for community feedback: `16.7.0-alpha.0`, `16.7.0-alpha.1`, `16.7.0-alpha.2`, and `16.8.0-alpha.0`.
60+
61+
**We don't recommend depending on alphas in production code.** We publish them so we can make breaking changes in response to community feedback before the API is stable.
62+
63+
Here is a list of all breaking changes to Hooks between the first alpha and the stable release:
64+
65+
* Remove `useMutationEffect`. ([@sophiebits](https://github.com/sophiebits) in [#14336](https://github.com/facebook/react/pull/14336))
66+
* Rename `useImperativeMethods` to `useImperativeHandle`. ([@threepointone](https://github.com/threepointone) in [#14565](https://github.com/facebook/react/pull/14565))
67+
* Bail out of rendering on identical values for `useState` and `useReducer` Hooks. ([@acdlite](https://github.com/acdlite) in [#14569](https://github.com/facebook/react/pull/14569))
68+
* Don’t compare the first argument passed to `useEffect`/`useMemo`/`useCallback` Hooks. ([@acdlite](https://github.com/acdlite) in [#14594](https://github.com/facebook/react/pull/14594))
69+
* Render components with Hooks twice in Strict Mode (DEV-only). ([@gaearon](https://github.com/gaearon) in [#14654](https://github.com/facebook/react/pull/14654))
70+
* Improve the `useReducer` Hook lazy initialization API. ([@acdlite](https://github.com/acdlite) in [#14723](https://github.com/facebook/react/pull/14723))
71+
72+
Read more about our [versioning policy and commitment to stability](/docs/faq-versioning.html).
73+
5574
## Installation
5675

76+
### React
77+
5778
React v16.8.0 is available on the npm registry.
5879

5980
To install React 16 with Yarn, run:
@@ -77,6 +98,37 @@ We also provide UMD builds of React via a CDN:
7798

7899
Refer to the documentation for [detailed installation instructions](/docs/installation.html).
79100

101+
### ESLint Plugin for React Hooks
102+
103+
>Note
104+
>
105+
>If you're using Create React App, instead of manually configuring ESLint you can wait for the next version of `react-scripts` which will come out shortly and will include this rule.
106+
107+
Assuming you already have ESLint installed, run:
108+
109+
```sh
110+
# npm
111+
npm install eslint-plugin-react-hooks@next --save-dev
112+
113+
# yarn
114+
yarn add eslint-plugin-react-hooks@next --dev
115+
```
116+
117+
Then add it to your ESLint configuration:
118+
119+
```js
120+
{
121+
"plugins": [
122+
// ...
123+
"react-hooks"
124+
],
125+
"rules": {
126+
// ...
127+
"react-hooks/rules-of-hooks": "error"
128+
}
129+
}
130+
```
131+
80132
## Changelog
81133

82134
### React
@@ -92,6 +144,7 @@ Refer to the documentation for [detailed installation instructions](/docs/instal
92144
* Render components with Hooks twice in Strict Mode (DEV-only) to match class behavior. ([@gaearon](https://github.com/gaearon) in [#14654](https://github.com/facebook/react/pull/14654))
93145
* Warn about mismatching Hook order in development. ([@threepointone](https://github.com/threepointone) in [#14585](https://github.com/facebook/react/pull/14585) and [@acdlite](https://github.com/acdlite) in [#14591](https://github.com/facebook/react/pull/14591))
94146

147+
95148
### React Test Renderer
96149

97150
* Support Hooks in the shallow renderer. ([@trueadm](https://github.com/trueadm) in [#14567](https://github.com/facebook/react/pull/14567))

0 commit comments

Comments
 (0)