react-instantsearch-nextjs: <SearchBox />
outside <InstantSearchNext />
#6026
-
I'm implementing Starting from the official NextJS Algolia example and little by little matching the code inside with the one of my app. Overall everything is working fine expect one thing: When trying to put the What I don't want to do is wrap my whole app layout inside a single So I'm about to create a Is there a better way of handling that ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I'm not sure if that's compatible with RSC or your app, but have you considered React Portals? In the past this solution has worked well for putting components in the header. One thing we don't have is instantiating the InstantSearch once and then passing that to multiple providers. This is possible in theory, but I'm not sure how it could be done practically with a nice API. You could probably imagine creating the InstantSearch instance (inside the InstantSearch component, useInstantSearchAPI private hook return value), then passing that to the private InstantSearch providers etc. If you're interested in exploring that, that would be interesting |
Beta Was this translation helpful? Give feedback.
-
I've been searching the instantsearch repository and more precisely these 2 files, trying to understand how to use the Even though I kind of understand how everything is working, the implementation itself is too complex for me to create a custom instantiable Anyway thank you for your help but i think I'll wait for an update that will let us do that rather than me doing some dodgy things |
Beta Was this translation helpful? Give feedback.
I'm not sure if that's compatible with RSC or your app, but have you considered React Portals? In the past this solution has worked well for putting components in the header.
One thing we don't have is instantiating the InstantSearch once and then passing that to multiple providers. This is possible in theory, but I'm not sure how it could be done practically with a nice API. You could probably imagine creating the InstantSearch instance (inside the InstantSearch component, useInstantSearchAPI private hook return value), then passing that to the private InstantSearch providers etc. If you're interested in exploring that, that would be interesting