API Reference
/
React InstantSearch Hooks
/
getServerState()
May. 12, 2022
getServerState()
Signature
getServerState(<App />)
About this function
getServerState()
is the function that retrieves the server state to pass to <InstantSearchSSRProvider>
.
This function is available from the companion react-instantsearch-hooks-server
package.
Examples
Copy
1
2
3
import { getServerState } from 'react-instantsearch-hooks-server';
const serverState = await getServerState(<App />);
Check the server-side rendering example for full markup.
Parameters
children
|
type: React.ReactNode
The part of the app that renders |
||
Copy
|
Returns
Promise
Promise
serverState
|
type: InstantSearchServerState
The server state to pass to
Copy
|
Did you find this page helpful?