Reputation: 83
I have purchased a theme on ThemeForest which I would like to use with my ReactJS project. As I am still learning React, I would like to know if it is okay to simply include Style.css file in 'public/index.html' file just like I would do with any website or is there a way which is specific to React?
Upvotes: 0
Views: 525
Reputation: 20236
You can simply include the style.css file in your index.html and use the CSS classes defined in the stylesheet with your React components. One thing to note is that you have to use className
instead of class
to reference the CSS classes, because React is basically JavaScript code and “class” is a reserved word in JS. Example:
<div className="my-class">bla</div>
Upvotes: 1
Reputation: 10206
That is an acceptable method.
Alternatively you can use something like require('./style.css')
in your app entry point file, as long as you have something like webpack set up.
Upvotes: 1