1.0.6 • Published 7 years ago

react-form-data-handler v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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