injectGlobal doesn't working in SSR
See original GitHub issueVersion
2.0.0-15
Expected Behavior
I have an injectGlobal style and I want to fetch this CSS on the server.
Actual Behavior
I’m using const styles = styleSheet.getCSS();
to fetch my current CSS on the server, but it just return the CSS of my components, global styles are not returned.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How to inject global styles while rendering server-side with ...
Turns out, calling baseStyles() (which in turn is calling injectGlobal ) in my <App /> component render() method fixed the problem. :).
Read more >Releases - styled-components
This is a replacement for the injectGlobal API. ... While this is not guaranteed to work with SSR yet, it can help you...
Read more >styled-components getting started - Scott Spence
Style the body with injectGlobal. For styling the body of our react app we currently have the index.css file that is being imported...
Read more >Server Side Rendering - Emotion
The default approach works with streaming and requires no additional configuration, but does not work with nth child or similar selectors.
Read more >Next.js + Styled Components The Really Simple Guide +
Tagged with react, nextjs, ssr, javascript. ... Amazing the configuration of ".babelrc" was not working with the default configuration of ...
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
Where is your call to
injectGlobal
?For what it’s worth, using the ye olde
method works with
injectGlobal
in2.0.0-15
.