Skip to main content
This is the React InstantSearch v7 documentation. If you’re upgrading from v6, see the upgrade guide. If you were using React InstantSearch Hooks, this v7 documentation applies—just check for necessary changes. To continue using v6, you can find the archived documentation.
Signature

Import

JavaScript

About this function

If you use Next.js’s App Router, a dedicated react-instantsearch-nextjs package is available. To learn more, see App router.
getServerState is the function that retrieves the server state to pass to <InstantSearchSSRProvider>. To learn more, see Server-side rendering.

Examples

Check the server-side rendering example for full markup.

Parameters

children
React.ReactNode
The part of the app that renders <InstantSearch>. As an optimization you can pass a minimal version of the application that only uses the hooks of the widgets used in the search, with the same options.
JavaScript
renderToString
(node: React.ReactElement) => unknown
The react method used to render the app. This can be renderToString from react-dom/server or an alternative method.
JavaScript

Returns

serverState
InstantSearchServerState
The server state as a Promise to pass to <InstantSearchSSRProvider>.
Type definitions
Last modified on June 16, 2026