AntDesign
这是蚂蚁金服推出的设计语言,蚂蚁金服官方基于该设计语言实现了React组件库
安装
npm i --save antd
# 或者
yarn add antd
引入css
我们在App.css通过css引入模式进行引入
App.css
@import '~antd/dist/antd.css';
或者我们可以在App.js中引入css
App.js
import "antd/dist/antd.css"
使用组件
React组件不支持全局注册,我们需要在我们对应的使用到antd组件的组件里,引入对应需要的组件
App.js
import { Button } from 'antd'
function App() {
return (
<Button></Button>
)
}
注意:antd中有些代码不符合React.StrictMode模式,所以未来如果不希望因严格模式导致的警告出现,可以把index.js中的<React.StrictMode></React.StrictMode>标签删除
ReactDOM.render(
<App />,
document.getElementById('root')
);