Css is not used by jsx in ReactJS

Css is not used by jsx in ReactJS

I use ReactJS with Webpack and TypeScript. I'm trying to include CSS with React. But my CSS is not use by my React application. I created a global.d.ts file to declare my css module. I imported my css into my.tsx file but when I add a class to an element, nothing works.

I use ReactJS with Webpack and TypeScript. I'm trying to include CSS with React. But my CSS is not use by my React application. I created a global.d.ts file to declare my css module. I imported my css into my.tsx file but when I add a class to an element, nothing works.

I have already tried to install a css module but I didn't succeed. So, I just made the solution to create a global.d.ts file

global.d.ts :

declare module '*.css';

Hello.tsx

import * as css from './Hello.css';

export interface HelloProps { compiler: string; framework: string; }

export class Hello extends React.Component<HelloProps, {}> {

render() { return ( <form> <p className={css.test}> Test </p> </form> ); } }

Hello.css

.test {
   color: red;
}

webpack.config.js

module: {
   rules: [

 .....

 { test: /\.css$/, exclude: /node_modules/, use: ['style-loader', 'css-loader'] }

] },

The word "test" is written in black. When it should be in red

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

React How to Use Bulma CSS With ReactJS

Learn How to Use Bulma CSS Framework With ReactJS. How to include Bulma CSS and JS in reactjs app. Adding Bulma CSS to a React App.

TypeScript interface signature for the onClick event in ReactJS

The official&nbsp;<a href="https://reactjs.org/tutorial/tutorial.html" target="_blank">reactjs.org</a>&nbsp;website contains an excellent introductory tutorial.