Note: use formik instead :)
DEMO: http://projectstorm.cloud/react-forms
A super simple, no-nonsense form library written in React that (hopefully) just works.
Forms in React can be quite difficult, but with this library, forms become quite easy. Storm React Forms (SRF) provides a simple way to create forms in a very declarative way.
Declare your form using standard react widgets, but make use of Storm Element Widgets
when you want to actually use an input field. When you click submit on your form, the form
will fire a formSubmitEvent(model)
which will contain an object with all the values in your form.
<FormWidget formSubmitEvent={ model => console.log(model) }>
<TableLayoutWidget>
<FieldElementWidget name="Name" />
<FieldElementWidget name="Surname" />
</TableLayoutWidget>
</FormWidget>
The model will contain {Name, Surname}
you can pass a value={object}
onto a form and it will automatically populate
your form fields with the values in the object. This does not change object
when the form fires
but instead will pass the new object as the first param in the formSubmitEvent(object)
(like in the previous example)
Take a look at the demos URL as well as the demos folder (docs will follow soon)