react-form-data-handler
v1.0.6
Published
Simplify your work at handling the form especially its data. no more headache for handling the state.
Downloads
3
Maintainers
Readme
react-form-data-handler
Simplify your work at handling the form-data. no more headache for managing the state.
Install
npm install react-form-data-handler
Usage
import React, { Component } from 'react';
import Form from 'react-form-data-handler';
class Test extends Component{
submit(e){
e.preventDefault();
// you can get the form data by accessing class state "this.state.input"
}
render(){
return(
<Form
onSubmit={this.submit.bind(this)} // binding a submit function
stateSetter={(input) => {this.setState({input})}} // needed to set your state
>
/*
* write all your input field components here..
* example <input type="text" defaultValue="john doe" name="fullname" />
*/
</Form>
);
}
}
License
MIT © Dony Ariesta