Next.js
Next.js + React 18 -> SSR will only work with Next.js 12.1.7-canary.4 or newer.
Setup to make SSR work with Next.js.
The following instructions are assuming you are using @mui
v5.
You can find here a Next.js setup with @material-ui
v4.
pages/_document.tsx
page/index.tsx
You can find a working example here.
This setup is merely a suggestion. Feel free, for example, to move the <CacheProvider/>
into pages/_app.tsx
.
What's important to remember however is that new instances of the caches should be created for each render!
If you are using nested selectors, you may need to provide uniq identifiers to your stylesheet.
Last updated