Skip to content
Discussion options

You must be logged in to vote

I deleted my previous comment.

Actually, I think the issue is that getServerState is trying to use renderToString of your <Search> component, but you can't do that without a Remix context. That's why it complains about useHref.

It should probably work if you wrap the <Search> component inside <ClientOnly> from remix-utils:

export const Search = ({ serverUrl, serverState }) => {
  return (
    <ClientOnly fallback={<p>Loading...</p>}>
      {() => (
        <InstantSearchSSRProvider {...serverState}>
          <InstantSearch>
            <Link to={anotherPage} />
          </InstantSearch>
        </InstantSearchSSRProvider>
      )}
    </ClientOnly>
  );
};

https://github.com/sergiodxa/r…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jentoobento
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants