Can some one tell how to style the react apps using CSS.
There is more than one way. The more traditional way is to add a class.
<p className='heavy'>Hey there!<p>
Not that in React it is “className” and not “class”.
Then at the top of the file you would import your css file like:
import 'myCSSFile.css';
Another way to do it is writing your styles inline:
<p style={ { fontWeight: 'bold' } }>Hey there!<p>
Note that you are passing an object and the properties are now camelCase and values have to be valid JS types.
There are some other ways too, often with libraries, but this is the gist.
1 Like