You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rendering on the server is not much different than rendering in the
2
-
browser. The primary difference is that while on the client we can do
3
-
asynchronous work *after* rendering, on the server we have to do that
4
-
work *before* rendering, like path matching and data fetching.
1
+
## Server Rendering
5
2
6
-
We'll start with the client since it's pretty simple. The only
7
-
interesting thing is that we are getting some initial data from the
8
-
server render to ensure that the first client render markup matches the
9
-
the markup from the server render. Without the initial data, the markup
10
-
the client creates would differ from what the server sent, and React
11
-
would replace the DOM.
3
+
Rendering on the server is not much different than rendering in the browser. The primary difference is that while on the client we can do asynchronous work *after* rendering, on the server we have to do that work *before* rendering, like path matching and data fetching.
4
+
5
+
We'll start with the client since it's pretty simple. The only interesting thing is that we are getting some initial data from the server render to ensure that the first client render markup matches the the markup from the server render. Without the initial data, the markup the client creates would differ from what the server sent, and React would replace the DOM.
On the server, we need to asynchronously match the routes and fetch data
23
-
first, and then provide the initial state to the router so it renders
24
-
synchronously.
19
+
On the server, we need to asynchronously match the routes and fetch data first, and then provide the initial state to the router so it renders synchronously.
0 commit comments