UNPKG
4leaf-hooks-useinput
Version:
latest (0.0.3)
0.0.3
0.0.2
0.0.1
React Hooks to realtime change input value
github.com/riosee2415/4leaf-hooks/useInput
4leaf-hooks-useinput
/
useInput.js
14 lines
(9 loc)
•
259 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import
React
, { useState }
from
"react"
;
const
useInput
= (
initValue
) => {
const
[value, setValue] =
useState
(initValue);
const
onChange
= (
e
) => {
setValue
(e.
target
.
value
); };
return
{ value, onChange, setValue }; };
export
default
useInput;