SSR : Empty css with @emotion/css and @emotion/cache
See original GitHub issueCurrent behavior:
I followed the documentation here to extract my styles but I get an empty css.
If I use @emotion/react, it works.
If I use @emotion/css
and extractCritical
directly, it also works. But will the hydration work too ? If I test, I get twice the style, the one I inject into the head and the one injected in some kind of shadow(?) style.
To reproduce:
- Go here : https://stackblitz.com/edit/node-gbbg6l
npm run start
- Styles are empty for the
@emotion/css
+@emotion/cache
test
Expected behavior:
The styles are correctly extracted.
Environment information:
react
version: 18.0.0@emotion/react
version: 11.9.0
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Server Side Rendering - Emotion
If you have dynamic global styles it's advised to create cache per single render to avoid global styles from different renders leaking into...
Read more >emotion/cache on SSR with Material-UI is always empty
The ID extraction in createExtractCriticalToChunks work well, but the cache. inserted object from emotion is now always an empty object.
Read more >Top 5 emotion-server Code Examples - Snyk
Learn more about how to use emotion-server, based on emotion-server code examples ... renderStatic(); // Flush chunk names and extract scripts, css and ......
Read more >@emotion/server | Yarn - Package Manager
Extract and inline critical css with emotion for server side rendering. ... to the css prop, a Global component for dynamic global styles,...
Read more >Material UI v5 - Emotion SSR - help - Meteor forums
I've set it up, but I cannot succeed to fill Emotion cache. ... up just missing the user agent detection for responsive css...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@antonybudianto you might want to grab
cache
from@emotion/css
and provide it to your app using<CacheProvider/>
Hi, what if we need to use both
@emotion/css
and@emotion/react
? Let’s say I still have a case where I still need to use css + className for gradual migration.