- Ant Design of React
- Changelogv6.1.3
- Basic Usage
- AI
- Advanced
- Migration
- Other
Vite is one of the best React application development tools. Let's use antd within it.
$ npm create vite antd-demo
The tool will create and initialize environment and dependencies automatically, please try config your proxy setting, or use another npm registry if any network errors happen during it.
Then we go inside antd-demo install dependencies and start it.
$ cd antd-demo$ npminstall$ npm run dev
Open the browser at http://localhost:5173/. It renders a header saying Vite + React on the page.
Below is the default directory structure.
βββ publicβ βββ vite.svgβββ srcβ βββ assetsβ βββ react.svgβ βββ App.cssβ βββ App.jsβ βββ index.cssβ βββ main.jsβ βββ logo.svgβββ index.htmlβββ package.jsonβββ vite.config.ts
Now we install antd from yarn or npm or pnpm or bun.
$ npminstall antd --save
Modify src/App.js, import Button component from antd.
importReactfrom'react';import{Button}from'antd';constApp=()=>(<divclassName="App"><Buttontype="primary">Button</Button></div>);exportdefaultApp;
OK, you should now see a blue primary button displayed on the page. Next you can choose any components of antd to develop your application. Visit other workflows of Vite at its User Guide.
We are successfully running antd components now, go build your own application!