What to do if react component style reference fails

藏色散人
Release: 2023-01-04 10:52:46
Original
2264 people have browsed it

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.

What to do if react component style reference fails

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
Copy after login

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';
Copy after login

3. Introduce it into the project The components we want, so we can see the effect!

import { Button } from "antd";
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!