How to handle css styling in source folder not affecting the html page in public folder in React projects

Viewed 18

Firstly, I initialize a template React App using npx create-react-app my-app


Then, I modify the project, and here is my project directory which my-app is the root:

  • my-app
    • node_modules
    • public
      • index.html
      • manifest.json
      • robots.txt
    • src
      • components
        • Main.js
        • Navbar.js
      • fonts
      • images
      • App.js
      • index.js
      • style.css
    • package-lock.json
    • package.json

In HTML <head> I attach a stylesheet reference <link rel="stylesheet" href="../src/style.css"> but it didn't work, how to handle this?. Notice that I am not trying to attach or import a stylesheet in Javascript (JSX) file but rather import CSS styling to an HTML file but it seems the react app doesn't allow index.html to import the styling from another folder.

1 Answers
Related