Browse Source

Update 2018-03-27-update-on-async-rendering.md

main
Sophie Alpert 7 years ago
committed by GitHub
parent
commit
78a2a196f7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      content/blog/2018-03-27-update-on-async-rendering.md

4
content/blog/2018-03-27-update-on-async-rendering.md

@ -93,6 +93,8 @@ There is a common misconception that fetching in `componentWillMount` lets you a
> Some advanced use-cases (e.g. libraries like Relay) may want to experiment with eagerly prefetching async data. An example of how this can be done is available [here](https://gist.github.com/bvaughn/89700e525ff423a75ffb63b1b1e30a8f).
>
> In the longer term, the canonical way to fetch data in React components will likely be based on the “suspense” API [introduced at JSConf Iceland](/blog/2018/03/01/sneak-peek-beyond-react-16.html). Both simple data fetching solutions and libraries like Apollo and Relay will be able to use it under the hood. It is significantly less verbose than either of the above solutions, but will not be finalized in time for the 16.3 release.
>
> When supporting server rendering, it's currently necessary to provide the data synchronously – componentWillMount was often used for this purpose but the constructor can be used as a replacement. The upcoming suspense APIs will make async data fetching cleanly possible for both client and server rendering.
### Adding event listeners (or subscriptions)
@ -194,4 +196,4 @@ npm install react-lifecycles-compat --save
Next, update your components to use the new lifecycles (as described above).
Lastly, use the polyfill to make your component backwards compatible with older versions of React:
`embed:update-on-async-rendering/using-react-lifecycles-compat.js`
`embed:update-on-async-rendering/using-react-lifecycles-compat.js`

Loading…
Cancel
Save