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.

Next.js SSR example question

See original GitHub issue

In the nextjs example pages/_app.js

  componentDidMount() {
    // Remove the server-side injected CSS.
    const jssStyles = document.querySelector('#jss-server-side');
    if (jssStyles && jssStyles.parentNode) {
      jssStyles.parentNode.removeChild(jssStyles);
    }
  }

Why remove the injected css ?

I use koa to deploy the nextjs app, after I build it. The styles will be removed if I add this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
codyngcommented, Feb 26, 2020

So can we disable the generation of injection of <style id="jss-server-side">html {…} into the HTML so we don’t need to manually remove it in the client side script?

0reactions
blastZcommented, Jan 30, 2019

@oliviertassinari That’s clear, thanks for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Top 20+ Next JS Interview Questions 2022 - MindMajix
Next JS Interview Questions · Can you use Next JS with Redux? · What do you mean by SSR? · What is DOM?...
Read more >
Top 40 Next.JS Interview Questions & Answers 2023 | MindMajix
This MindMajix video on Next JS Interview Questions and Answers video includes all the frequently asked Interview questions that give you an ...
Read more >
20 Next.js Interview Questions and Answers - CLIMB
8. What is SSR (Server Side Rendering)? Why is it important for Next.js applications? ... Server Side Rendering (SSR) is the process of...
Read more >
Next JS Server Side Rendering (SSR) Implementation ...
NextJs is a great framework that offers many features for enhancing NextJS SEO optimization and user-experience. One staple feature is server side rendering ......
Read more >
React Next.js - Three related questions about SSR patterns
This is true whether you're using SSR (the html is created on demand on the server) or SSG (the html is created at...
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