Skip to content

Sharing state across pages #5316

Discussion options

You must be logged in to vote

It highly depends on your app configuration. Wrapping your page in the <InstantSearch> component should work, but you should also have the widgets responsible for the UI state mounted on each page.

For instance, for initialUiState.indexName.refinementList.brand to be effective, you need to mount the <RefinementList attribute="brand" /> on your page. This is a limitation of InstantSearch so that the UI state is taken into account. If you don't want to display any refinements, you can mount a "virtual widget", which means calling the Hook without rendering anything:

function Page() {
  useRefinementList({ attribute: 'brand' });
  // ...
}

function App(props) {
  return (
    <InstantSearch {

Replies: 0 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by louis030195
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Library: React InstantSearch ≥ 7 Issues in any of the react-instantsearch@7 packages (formerly named react-instantsearch-hooks)
2 participants