How to implement SSR with Next.js pages router with third party providers #6448
Unanswered
branislav-brincko
asked this question in
General
Replies: 1 comment
-
You need to wrap your SearchPage in the Intl provider if you're using those, or make the code conditional so they don't need the intl, for the contexts of InstantSearch, your SearchPage doesn't technically need to be exactly the same as your real implementation, only need to have the same widgets with the same options. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm struggling with implementing SSR in Next.js using the Pages Router. Specifically, I don’t understand how to avoid errors when rendering a page with getServerSideProps when the page needs to be wrapped in providers, such as those used for an i18n library like next-intl.
For example, when I include useTranslations in the following scenario, I encounter the error:
"Error: No intl context found."
As a result, the page fails to render.
Wrapping pages in various providers (e.g., for next-intl or UI libraries) is a common practice, and this is typically handled in _app.tsx. However, when rendering the page with getServerSideProps, these providers are not available.
How to deal with this issue?
Thank you in advance for any help! 🙏🙏🙏
Beta Was this translation helpful? Give feedback.
All reactions