useServerState

The useServerState hook allows you to manage server state when using Hydrogen as a React Server Component framework.

Example code

Return value

The useServerState hook returns an object with the following keys:

Key Description
serverState The current server state.
setServerState A function used to modify server state.
pending Whether a transition is pending.