React Reactive Forms
It's a library inspired by the Angular's Reactive Forms, which allows to create a tree of form control objects in the component class and bind them with native form control elements.
Features
- UI independent.
- Zero dependencies.
- Nested forms.
- Subscribers for value & status changes of controls.
- Provides a set of validators & also supports custom sync & async validators.
- Better form management with
FormGroup
&FormArray
apis. - Customizable update strategy for better performace with large forms.
Installation
Basic Example
Add Controls Dynamically
You can also create controls without even initializing the group control object with the help of new react form components ( FieldGroup, FieldControl, FieldArray).
So, it's not mandatory that you need to define your control separately but if you want a better control over your form state then you should do that, if your controls are dynamic then you can also initalize the empty group control and add the controls later.
See the example: