I'm trying to use Ant Design Pro Form following the documentation here : https://procomponents.ant.design/en-US/components/modal-form/
However, I keep getting syntax errors when trying to reproduce their example. What causes problem is this particular syntax :
<DrawerForm<{
name: string;
company: string;
}>
title="..."
...
>
I first thought it was a custom syntax specific to Ant Design Pro until I realised it was probably Typescript JSX. However I'm totally unable to find a such syntax in the react docs (nor typescript docs).
I understand that DrawerForm<{name: string; company: string;}> is probablu a sort of template-type, and the {name: string; company: string;} is a data-structure that is supposed to represent the form model, but nothing is cleary explained.
Can this be ommited ? What's the point of this here (this structure doesn't even match the form fields).
Otherwise, I was struggling with this example code from this page (https://procomponents.ant.design/en-US/components/form) :
// Set overall default values
<ProForm initialValues={obj} />
// Set the individual control's
<ProForm
onValuesChange={(changeValues) => console.log(changeValues)}
>
<ProFormText initialValue="prop"/>
</ProForm>.
// Interdependent component linkage
<ProForm
<ProForm.Item noStyle shouldUpdate>
{(form) => {
return (
<ProFormSelect
options={[
{
value: "chapter",
label: "Effective when stamped",
},
]}
width="md"
name="useMode"
label={`with${form.getFieldValue("name")}contract agreement effective mode`}
/>
);
}}
</ProForm.Item>.
</ProForm>;
// Using custom components
<ProForm
<ProForm.Item name="switch" label="Switch" valuePropName="checked">
<Switch />
</ProForm.Item
</ProForm
which seems erratic, tags are unclosed. Can you please confirm it is not just me who misses something ?