Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ssrPublic

Avoid useless initialState for static data. #47

Open
Milestone
@cbilotta

Description

@cbilotta

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp