So for example for the HTML we have the index.html file on the public folder that we can clearly see. Now my question is how bout CSS. I have CSS for each of my components of a react application but I want to use things like variables and constants that run across an application. Someone explain this to me.
CodePudding user response:
You should define all variables and constants that you want to use across your project, in one file and import in App.js or index.js as a css file.
App.js
import "./style.css"
styles (classes) that you define in this file, are accessed all over your project.
CodePudding user response:
Well you have to declare variables in a file (for example _var.css) but you should import that file in every file css of your components using @import, but you can prevent this if you are using a library of styling like styled-components
