javascript – Why React Js is not loading css when change the anchor tag to link tag?

The difference between using an anchor tag and a Link component from the React Router library is that the anchor tag will cause the page to refresh and load a new HTML document while the Link component will update the URL in the browser without causing a page refresh.
You can just google and read more about it.

To solve this, you can import the CSS file in your main component or in the index.js file of your application using the import statement. This will ensure that the CSS file is always loaded when the application starts and the styles will be applied to all components even when using the Link component.

import './style.css';

This will import the CSS file and ensure that it is loaded in the application.

Read more here: Source link