Skip to content
Discussion options

You must be logged in to vote

I think you have to not treat Infinity (which is what react-use's useWindow hook returns if it's called as part of SSR) as if it has meaning for your render. Doing so sets you up for a disconnect between the server-rendered HTML (which rendered as if the page were infinitely wide) and the client-rendered HTML (which renders with the proper page width), which is actually what is causing your error.

(If you console.log(displayContext); in your Child component, you can see that the react context is, in fact, passing the right value to the component. The error is that component generates an error on the client-side when it tries to attach to the server-rendered DOM.)

To eliminate that disconn…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@AndrewSB
Comment options

@zackdotcomputer
Comment options

@AndrewSB
Comment options

Answer selected by AndrewSB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #12579 on May 07, 2020 09:15.