Extend Form & Field
Extend Form & generic Field
Import the base Form
and Field
class:
import MobxReactForm, { Field } from 'mobx-react-form';
or you can also import the base Form
like this:
import { Form, Field } from 'mobx-react-form';
extend the Field
(for example with custom props):
class MyField extends Field {
// ...
constructor(props) {
super(props);
// ...
}
}
implement MyField
into the makeField()
method of the Form
class:
class MyForm extends Form {
makeField(props) {
return new MyField(props);
}
}
then create the form instance using MyForm
class:
export default new MyForm( ... );