React component style reference failure solution: 1. Download and install the antd dependency package through "npm i --save antd"; 2. Introduce the antd style at the top of index.css; 3. Through "import { Button } from "antd";" Just introduce the desired components into the project.
The operating environment of this tutorial: Windows 10 system, react18.0.0 version, Dell G3 computer.
What should I do if the style reference of react component fails?
About the problem that the antd style introduced in the react project does not take effect
1. Download and install the antd dependency package in the react project
npm i --save antd
2. In index. Introduce antd style at the top of css (antd document says to introduce style at the top of app.css, I don’t know why the style doesn’t take effect when I tried it)
@import '~antd/dist/antd.css';
3. Introduce it into the project The components we want, so we can see the effect!
import { Button } from "antd";