I am building a very simple react app. Everything works fine except the CSS file is not loaded, where is the problem?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link type="text/css" rel="stylesheet" href="/animal_fun_facts/src/styles.css" />
</head>
<body>
<div id="root"></div>
<script src="/animal_fun_facts/src/index.js"></script>
<script src="/app.compiled.js"></script>
</body>
</html>
This is the file structure:

You can use so many ways actually
Like css modules,
Since you have created your stylesheet In a separate file, then let's just import it in your application
Use the following :
import React from 'react';
import ReactDOM from 'react-dom';
import './animal_fun_facts/src/styles.css';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With