Skip to content

Is context provider in SSR mode necessary? #87

Answered by lostpebble
bolu61 asked this question in Q&A
Discussion options

You must be logged in to vote

If you are manipulating the state during the rendering on the server-side and need to hydrate that state on the client side (which is generally always the case) - then there is no other way to go about it than using context.

Any library which does SSR and is manipulated during a render needs to have context- there's no way around it, because each separate user "request" on a server needs to maintain a unique state, which can't be controlled globally like we do on the client (otherwise all requests share the same state and clash / overwrite each other)- hence context is required.

If you are not manipulating the state during rendering on the server, then you don't need the context provider.…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@bolu61
Comment options

@lostpebble
Comment options

Answer selected by bolu61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants