#Hey guys, how do i connect css to react?
18 messages · Page 1 of 1 (latest)
like this?
The import path needs to be relative.
because it shows an error
Have you learned about import relative paths yet?
no
not yet
Ok, imagine you are in the index.js file. You have to move from that file, to the App.css file to create the path. If you want to look in the current folder, you use ./ If you want to go up a level in the folder structure, you use ../
So in this case, we need to go up a level, then into views, then select the file, so we do this:
import '../views/App.css'
okay thank you alot!
👍
Put all the css inside your src folder @unborn charm
All code that you write should go in src
so everything should basically be in source? can i create sub folders tho?
create subfolders but everything you write should be in src
/views/App.css'``` and this is how i should import it if all the css files where in the sub forlder
If the views folder is inside src, then you just need to do import './views/App.css'
Okay thank you alot for your
patience