Skip to content

Can the router have configuration added to optionally use history.replaceState over history.pushState? #5329

Answered by dhayab
jakecollins1 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, thanks for your feedback.

For React InstantSearch, you can change the call to history.push() with history.replace() in the onSearchStateChange event handler you attach to <InstantSearch>. You can follow this guide for more information: https://www.algolia.com/doc/guides/building-search-ui/going-further/routing-urls/react/#basic-urls.

For React InstantSearch Hooks, you can use the modified history router I've shared in the discussion you created for InstantSearch.js: #5088 (comment).

Replies: 0 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by dhayab
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@6 packages
2 participants