https://github.com/arjun1237/dr-hooks
everday custom hooks for react developers
https://github.com/arjun1237/dr-hooks
Last synced: 2 months ago
JSON representation
everday custom hooks for react developers
- Host: GitHub
- URL: https://github.com/arjun1237/dr-hooks
- Owner: arjun1237
- Created: 2020-11-24T21:03:22.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2020-11-24T21:31:18.000Z (about 5 years ago)
- Last Synced: 2024-10-18T07:02:09.893Z (about 1 year ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# What is this ?
Everyday custom hooks for react developers.
# Installation
`npm i dr-hooks`
# How to use them ?
### useInputState hook (example)
```
import { useInputState } from 'dr-hooks';
function App(){
const init = {
password: "",
username: ""
}
const {password, username, update} = useInputState(init)
const handleChange = (e) => {
update(e)
}
const handleSubmit = (e) => {
e.preventDefault()
// handle form submit
}
return (
SUBMIT
)
}
```
**Arguments for useInputState hook function**
* *init* - initial value is required