Home >Web Front-end >Front-end Q&A >What to do if react component style reference fails
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";
6d1111a865a2d4d2a411253e652972f2This is a button51738bfe3c0543748d57de456193ed4a
Recommended learning: "react video tutorial 》
The above is the detailed content of What to do if react component style reference fails. For more information, please follow other related articles on the PHP Chinese website!