A simple react form binding helper which utilizes valueLink prop.
Install:
npm install -S react-form-to-state
Use:
Connect the wrapper
{ return ... ; } Form ;
Bind props
<input valueLink= thisprops /><input type="checkbox" checkedLink= thisprops />
Your form data is binded as this.state.form
. You can set a custom prop name this way: this.props.bindAs( "fieldName1", "myCustomFormName" )
Complete example
{ ev console; } { return <form onSubmit= this_submit > <input type="text" valueLink= thisprops /> <input type="password" valueLink= thisprops /> <label> <input type="checkbox" checkedLink= thisprops /> Keep me signed in </label> <button>Submit</button> </form>; } Form ;