我需要使用react-admin建立一个复杂的编辑表单。表单具有由react-admin的BooleanInput组件制作的各种yes / no滑块。如果用户将滑块设置为“是”,则应动态显示其他表单字段,这些字段在主题上涉及滑块。如何查询BooleanInput组件的状态,或者以其他方式解决此任务?
<BooleanInput source="yesno" label="show or hide fields" />
<AutocompleteArrayInput source="probably_hidden1" label="show or hide me" choices={[
{ id: 'one', name: '1' },
{ id: 'two', name: '2' },
{ id: 'three', name: '3' }
]} />
<TextInput multiline source="text" label="show or hide me too" />
您可以在JSX内部动态编写代码
> { isShow ? <TextInput ... /> : null }