react + antd创建一个项目
时间: 2023-10-02 15:04:53 浏览: 71
好的,以下是创建 React + Ant Design (Antd) 的项目所需的步骤:
1. 首先,安装 Node.js 和 npm(如果您还没有安装的话)。
2. 打开命令行工具,创建一个新的 React 应用程序。在命令行中输入以下命令:
```
npx create-react-app my-app
```
这将创建一个名为 "my-app" 的新的 React 应用程序。
3. 进入新创建的 "my-app" 目录:
```
cd my-app
```
4. 安装 Ant Design (Antd):
```
npm install antd
```
5. 在 "src/index.js" 文件中,引入 Antd 的样式和组件:
```
import 'antd/dist/antd.css';
import { Button } from 'antd';
```
6. 使用 Antd 的组件:
```
function App() {
return (
<div className="App">
<Button type="primary">Button</Button>
</div>
);
}
```
7. 运行应用程序:
```
npm start
```
运行后,在浏览器中访问 "http://localhost:3000",即可看到一个带有 Antd 按钮的 React 应用程序。
希望这些步骤可以帮助您创建 React + Antd 项目。