Answer the question
In order to leave comments, you need to log in
How to properly include css files in reactjs / nextjs?
Good afternoon.
I use nextjs for development. Out of the box uses module.css. I didn't want to use it. work landing layout with it is not very convenient for me. Looking for solutions on how to get rid of it.
I found a solution to connect styles globally. Do I understand correctly that if I connect all styles globally, then when I build the project, I will get one css file with styles, and if I use module.css and connect styles to each component, then when building, the styles will be used for each page depending on connection?
PS If anyone knows some ways to work with next without module.css, please tell me.
Answer the question
In order to leave comments, you need to log in
When building, React collects all module.css (css) and js (jsx, ts, tsx) into a heap, roughly speaking, it turns out one js and one css).
Globally, styles in React can be included in index.js at the very top by type:
import 'путь/к/файлу/относительно/index.js/foo.css';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question