Skip to content
Discussion options

You must be logged in to vote

This write up, reactwg/server-components#4 kind of covers your question and I'll try address some of your other questions.

Does it use the values from useState at build time?

The initial value yes.

How does it handle useEffect or useLayoutEffect?

In SSR, useEffect and useLayoutEffect do nothing. In fact, useLayoutEffect used to print a warning about being a no-op during SSR, meaning it didn't run at all. This distinction was needed because, unlike useEffect which runs after painting, useLayoutEffect typically runs before letting the browser paint, but what does that even mean in SSR!? it just didn't run, but you might have expected it to - facebook/react#14363 (comment)

Which hooks a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@amscu-dev
Comment options

Answer selected by amscu-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants