1.0.2 • Published 3 years ago

react-input-suman v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

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>
        );
    }
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago