import React from 'react'; import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; import { Button, Form, Input } from 'antd'; const formItemLayout = { labelCol: { xs: { span: 24 }, sm: { span: 4 }, }, wrapperCol: { xs: { span: 24 }, sm: { span: 20 }, }, }; const formItemLayoutWithOutLabel = { wrapperCol: { xs: { span: 24, offset: 0 }, sm: { span: 20, offset: 4 }, }, }; const App: React.FC = () => { const onFinish = (values: any) => { console.log('Received values of form:', values); }; return (
{ if (!names || names.length < 2) { return Promise.reject(new Error('At least 2 passengers')); } }, }, ]} > {(fields, { add, remove }, { errors }) => ( <> {fields.map((field, index) => ( {fields.length > 1 ? ( remove(field.name)} /> ) : null} ))} )}
); }; export default App;