From 161339b15a2c07a25067c894a09bdaa83d529f1c Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Tue, 27 Mar 2018 19:29:55 -0700 Subject: [PATCH] Added a note about SSR / cWM --- content/blog/2018-03-27-update-on-async-rendering.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/blog/2018-03-27-update-on-async-rendering.md b/content/blog/2018-03-27-update-on-async-rendering.md index d852a02a..1461003a 100644 --- a/content/blog/2018-03-27-update-on-async-rendering.md +++ b/content/blog/2018-03-27-update-on-async-rendering.md @@ -94,6 +94,10 @@ There is a common misconception that fetching in `componentWillMount` lets you a > > 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. +> Note +> +> 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 add a way to do async data fetching cleanly for both client and server rendering. + ### Adding event listeners (or subscriptions) Here is an example of a component that subscribes to an external event dispatcher when mounting: