import React, { useState } from 'react'; import { Form, Input, Typography } from 'antd'; const { Paragraph } = Typography; interface FieldData { name: string | number | (string | number)[]; value?: any; touched?: boolean; validating?: boolean; errors?: string[]; } interface CustomizedFormProps { onChange: (fields: FieldData[]) => void; fields: FieldData[]; } const CustomizedForm: React.FC = ({ onChange, fields }) => (
{ onChange(allFields); }} >
); const App: React.FC = () => { const [fields, setFields] = useState([{ name: ['username'], value: 'Ant Design' }]); return ( <> { setFields(newFields); }} />
{JSON.stringify(fields, null, 2)}
); }; export default App;