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
On SSR, you sometime have to fill the store with data that has the only purpose of making the rendering of static HTML possible.
For example, if you want to render a static blogpost, you need to load the blogpost into the initial state, and then you basically have duplication of data between the store and the HTML sent to the client.
One solution to this could be to put an HOC around this block of static HTML that would, on mount in the client, take the innerHTML of it's children, and put it in the store, so for future re-renders, the needed data is actually in the store.
On the server, due to the way we walk the tree, we can easily delete this data from the initialStore and avoid sending it to the client.
This way, we could save precious bytes in the initial HTML payload.
The text was updated successfully, but these errors were encountered:
On SSR, you sometime have to fill the store with data that has the only purpose of making the rendering of static HTML possible.
For example, if you want to render a static blogpost, you need to load the blogpost into the initial state, and then you basically have duplication of data between the store and the HTML sent to the client.
One solution to this could be to put an HOC around this block of static HTML that would, on mount in the client, take the innerHTML of it's children, and put it in the store, so for future re-renders, the needed data is actually in the store.
On the server, due to the way we walk the tree, we can easily delete this data from the initialStore and avoid sending it to the client.
This way, we could save precious bytes in the initial HTML payload.
The text was updated successfully, but these errors were encountered: