AntDesign: Conditionally show form fields

What's the easiest way to show/hide another form field based on whether another is true or false? If Field A is true, Field B should be visible. If Field B is false, Field B should have it's value set to null and be hidden.

const { formLoading, formProps, onFinish, saveButtonProps, queryResult } = useForm<IOnboardingChecklist>({
    resource: 'onboarding_checklist',
    id: userID,
    redirect: false,
    warnWhenUnsavedChanges: false,
});
<Form
{...formProps}
layout='vertical'
>
<Row>
    <Col span={8}>
        <Form.Item label='User has LinkedIn account' name='has_linkedin_account'>
            <Switch />
        </Form.Item>
    </Col>
    {
        // TODO: Conditionally show this if has_linkedin_account is true
    }
    <Col span={8}>
        <Form.Item label='LinkedIn archiving completed' name='linkedin_archiving'>
            <Switch />
        </Form.Item>
    </Col>
</Row>
</Form>
Was this page helpful?