useServerProps
The useServerProps
hook allows you to manage the server props passed to your server components when using Hydrogen as a React Server Component framework. The server props get cleared when you navigate from one route to another.
Example code
Anchor link to section titled "Example code"
Return value
Anchor link to section titled "Return value"The useServerProps
hook returns an object with the following keys:
Key | Description |
---|---|
serverProps |
The current server props. |
setServerProps |
A function used to modify server props. |
pending |
Whether a transition is pending. |