Ant Design React is dedicated to providing a good development experience for programmers. Before starting, it is recommended to learn React first, and correctly install and configure Node.js v16 or above.
The official guide also assumes that you have intermediate knowledge about HTML, CSS, and JavaScript, and React. If you are just starting to learn front-end or React, it may not be the best idea to use the UI framework as your first step.
Finally, if you are working in a local development environment, please refer to Scaffolding Guide to create a new project.
Here is a simple online CodeSandbox demo of an Ant Design component to show the usage of Ant Design React.
Follow the steps below to play around with Ant Design yourself:
Visit https://u.ant.design/reproduce to create a CodeSandbox -- don't forget to press the save button as well to create a new instance.
If you are working in a local React project, install antd first. The CodeSandbox created above already includes this dependency.
$ npm install antd --save
Then replace the contents of your application's entry file (for example, src/main.jsx) with the following code. As you can see, there is no difference between antd's components and typical React components.
import React, { useState } from 'react';import { DatePicker, message } from 'antd';import { createRoot } from 'react-dom/client';import './index.css';const App = () => {const [date, setDate] = useState(null);const [messageApi, contextHolder] = message.useMessage();const