Using Link with react-instantsearch #8757
-
Is anyone else using react-instantsearch with a Link? This gives an error
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I deleted my previous comment. Actually, I think the issue is that It should probably work if you wrap the export const Search = ({ serverUrl, serverState }) => {
return (
<ClientOnly fallback={<p>Loading...</p>}>
{() => (
<InstantSearchSSRProvider {...serverState}>
<InstantSearch>
<Link to={anotherPage} />
</InstantSearch>
</InstantSearchSSRProvider>
)}
</ClientOnly>
);
}; https://github.com/sergiodxa/remix-utils?tab=readme-ov-file#clientonly |
Beta Was this translation helpful? Give feedback.
I deleted my previous comment.
Actually, I think the issue is that
getServerState
is trying to userenderToString
of your<Search>
component, but you can't do that without a Remix context. That's why it complains aboutuseHref
.It should probably work if you wrap the
<Search>
component inside<ClientOnly>
fromremix-utils
:https://github.com/sergiodxa/r…