question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Emotion does not create style tags using Next.js

See original GitHub issue

What happened before: I used css to add styles, which creates a class for the element and also injected the styles into<head> <style>…, now using next.js, it doesn’t but instead, I think the style is being injected through js files, and that gives me a problem: the styles are applied after the component appears on screen, so in my case I have a really big image , and I use emotion to set width, so when the screen is loaded, the image takes over the full screen, and only after that the emotion style, which defines width is applied.

And I don’t know what to do to solve it. Any suggestion? My site is live at https://webstation.dev, maybe on first load you will see that the images cover the entire screen, and only a few milliseconds that the emotion style is applied, and the image gets its expected size.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
lcswillemscommented, Dec 17, 2019

@Andarist The link you give to Next.js Emotion Fiber example should be added to SSR doc page, because currently, when I read this page, it says there is nothing to do with Next.js which is wrong (if I do nothing, <style> tags are added after the component).

More emotion-fiber is not a good name for the example. fiber means nothing for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

nextjs - page style not loading initially causing huge icons and ...
The simplest way I found to fix this is to add a loader which will look nice while the page loads and ...
Read more >
A/B test variations styling doesn't often look right using ...
A/B test variations styling doesn't often look right using `emotion` css styling with Next.js ... To fix this issue we need to post...
Read more >
Server Side Rendering - Emotion
To use emotion's SSR with Next.js you need a custom Document component in pages/_document.js that renders the styles and inserts them into the...
Read more >
Basic Features: Built-in CSS Support - Next.js
Next.js supports including CSS files as Global CSS or CSS Modules, using `styled-jsx` for CSS-in-JS, or any other CSS-in-JS solution! Learn more here....
Read more >
The best styling options for Next.js - LogRocket Blog
Another CSS framework created with React in mind is Emotion. It offers a CSS prop (to pass style directly to an element) and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found