1.0.2 • Published 3 years ago
react-input-suman v1.0.2
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>
);
}