Hello!
I am using the react-instantsearch-hooks
lib and trying to get routing working multiple indexes using the <Index />
component. I have it working where the url writes to the state, but not the state to the url.
I forked the Algolia routing example and made 2 changes: infallible-burnell-jcuktn - CodeSandbox
- Wrapped the Hits in an Index:
<Index indexName="instant_search">
<Hits hitComponent={Hit} />
</Index>
- returned the
parseURL
insearch-routing.js
to return it in a keyed object for the index:
return {
instant_search: {
query: decodeURIComponent(query),
page,
brands: allBrands.map(decodeURIComponent),
category
}
};
Instead of:
return {
query: decodeURIComponent(query),
page,
brands: allBrands.map(decodeURIComponent),
category
};
This makes the query appear in the search input when the page loads, e.g routing-basic
But typing in the input does not update the query in the url.
Is this possible with multiple indexes? Thank you!