import React from 'react'; import type { FormInstance } from 'antd'; import { Button, Form, Input, Space } from 'antd'; interface SubmitButtonProps { form: FormInstance; } const SubmitButton: React.FC> = ({ form, children }) => { const [submittable, setSubmittable] = React.useState(false); // Watch all values const values = Form.useWatch([], form); React.useEffect(() => { form .validateFields({ validateOnly: true }) .then(() => setSubmittable(true)) .catch(() => setSubmittable(false)); }, [form, values]); return ( ); }; const App: React.FC = () => { const [form] = Form.useForm(); return (
Submit
); }; export default App;