-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add note about NEXT_DATA hydration #37480
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can expand on this and potentially have a separate section specifically about hydration although this seems like a good initial note to have, thanks!
Yes, that's a nice idea. We can def. work something around this. |
@@ -68,6 +68,8 @@ For the initial page load, `getInitialProps` will run on the server only. `getIn | |||
- `getInitialProps` can **not** be used in children components, only in the default export of every page | |||
- If you are using server-side only modules inside `getInitialProps`, make sure to [import them properly](https://arunoda.me/blog/ssr-and-server-only-modules), otherwise it'll slow down your app | |||
|
|||
> Note that irrespective of rendering type, any `props` will be passed to the page component and can be viewed on the client-side in the initial HTML. This is to allow the page to be [hydrated](https://reactjs.org/docs/react-dom.html#hydrate) correctly. Make sure that you don't pass any sensitive information that shouldn't be available on the client in `props`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the format consistent with other notes. Note:
I think we can drop "that irrespective of rendering type"
Note:* Any props
returned in getInitialProps
will be passed to the...
"Make sure that you don't pass any" to just "Don't pass any..."
Missing documentation around
NEXT_DATA
hydration when usinggetServerSideProps()
. This PR warn users that the result ofgetServerSideProps()/getStaticProps
is also available on the client-side due to React Hydration so they should not use any sensitive information in the props.Bug
contributing.md
Feature
fixes #number
contributing.md
Documentation / Examples
pnpm lint