i try to generate dynamically forms on admin-on-rest but i really don't have idea how generate it. I try:
class MultipleChoice extends Component {
constructor(props) {
super(props);
this.state = { inputs: ['input-0'] };
}
render() {
return(
<div>
<Form>
<div id="dynamicInput">
{this.state.inputs.map(input => <FormInput key={input} />)}
</div>
</Form>
<button onClick={ () => this.appendInput() }>
CLICK ME TO ADD AN INPUT
</button>
</div>
);
}
appendInput() {
var newInput = `input-${this.state.inputs.length}`;
this.setState({ inputs: this.state.inputs.concat([newInput]) });
}
}
but i cant include on create of admin-on-rest any suggest is welcome, thanks