Skip to content

Commit 7e48614

Browse files
authored
Add extra info
1 parent 05b118a commit 7e48614

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

content/docs/reference-react-dom.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ React expects that the rendered content is identical between the server and the
7676

7777
If you intentionally need to render something different on the server and the client, you can do a two-pass rendering. Components that render something different on the client can read a state variable like `this.state.isClient`, which you can set to `true` in `componentDidMount()`. This way the initial render pass will render the same content as the server, avoiding mismatches, but an additional pass will happen synchronously during mounting. Note that this approach will make your components slower because they have to render twice, so use it with caution.
7878

79+
Remember to be mindful of user experience on slow connections. The JavaScript code may load significantly later than the initial HTML render, so if you render something different in the client-only pass, the transition can be jarring. However, if executed well, it may be beneficial to render a "shell" of the application on the server, and only show some of the extra widgets on the client. To learn how to do this without getting the markup mismatch issues, refer to the explanation in the previous paragraph.
80+
7981
* * *
8082

8183
### `unmountComponentAtNode()`

0 commit comments

Comments
 (0)