react-form-data-handler

1.0.6 • Public • Published

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

Package Sidebar

Install

npm i react-form-data-handler

Weekly Downloads

3

Version

1.0.6

License

MIT

Last publish

Collaborators

  • donyariesta