@nooks_seo/use-input
v2.0.0
Published
React Hook to manage input values with optional validation logic.
Readme
@nooks_seo/use-input
React Hook to manage input values with optional validation logic.
✅ TypeScript-friendly: this package now includes JSDoc type annotations so editors/TypeScript-aware IDEs get proper hints.
If you want to provide full .d.ts declarations for consumers, see the suggestions at the bottom of this message.
📦 설치
npm install @nooks_seo/use-input
# 또는
yarn add @nooks_seo/use-input사용 방법
import React from "react";
import { useInput } from "@nooks_seo/use-input";
function App() {
// 최소 10자 이상 입력해야 하는 validator
const maxLength = (value) => value.length <= 10;
const name = useInput("", maxLength);
return (
<div>
<input placeholder="Name" {...name} />
</div>
);
}
export default App;