react-input-suman

1.0.2 • Public • Published

what is this?

This is a useInput hooks. Its used for input field value and onchange funtion.

installation

npm install react-input-suman

Then ...

    import useInput from 'react-input-suman'

    function App() {
        const[firstName,bindfirstName,resetfirstName] = useInput('');
        const[lastName,bindlastName,resetlastName] = useInput('');
        const submitHamdler =(e)=>{
            e.preventDefault();
            alert(`hello ${firstName} ${lastName}`);
            resetfirstName()
            resetlastName()
        }
        return (
            <div className="App">
            <form onSubmit={submitHamdler}>
                    <div>
                        <label>First Name</label>
                        <input type="text" {...bindfirstName}/>
                    </div>
                    <div>
                        <label>Last Name</label>
                        <input type="text" {...bindlastName}/>
                    </div>
                    <button type="submit">Submit</button>
                </form>
            </div>
        );
    }

Readme

Keywords

Package Sidebar

Install

npm i react-input-suman

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

2.12 kB

Total Files

3

Last publish

Collaborators

  • suman-dev-cmd