@am-hooks/use-input
v1.0.0
Published
input
Downloads
3
Readme
useInput
input 유효성 검사 및 최대 텍스트 숫자 검증 가능
Installation
yarn
yarn add @am-hooks/use-input
npm
npm i @am-hooks/use-input
Usage 1
import useInput from "@am-hooks/use-input";
const App = () => {
const maxLen = value => value.length <= 10;
const name = useInput("", maxLen);
return (
<input placeholder="Name" {...name} />
)
}
Usage 2
import useInput from "@am-hooks/use-input";
const App = () => {
const validator = value => !value.includes("@");
const name = useInput("", validator);
return (
<input placeholder="Name" {...name} />
)
}