PullState
With
vite-plugin-ssr
we keep control over our app architecture; we can integrate
PullState simply by following its SSR docs.
On a high-level, the SSR integration works like this:
- We set the initial state of the store on the server-side. (We do it on the server-side so that the initial state is rendered to HTML.)
- We make the initial state available as
pageContext.initialStoreState
. - We make
pageContext.initialStoreState
available on the browser-side by adding 'initialStoreState'
to passToClient
. - We initialize the store on the browser-side using
pageContext.initialStoreState
.