create-react-app 创建项目

创建react项目时报错
error postcss@8.1.4: The engine "node" is incompatible with this module. Expected version "^10 || ^12 || >=14". Got "13.8.0"
在创建项目之前执行以下命令:yarn config set ignore-engines true

引入ant-design
安装:
yarn add antd -S
在index.js 引入:
import 'antd/dist/antd.css'
页面中使用:
import { Button } from 'antd';
<Button type="primary">按钮</Button>

create-react-app 创建的 react项目,默认就是支持Sass的,使用只需要安装一下 node-sass 这个包即可使用  (使用less稍微复杂)
npm install node-sass -D



运行报错

卸载npm uninstall node-sass -D 并重新安装 npm install node-sass@4.14.1

react 项目样式采用css module 
命名方式 【name】.module.css

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容