@smooks/use-input

1.0.1 • Public • Published

@smooks/use-input

React Hook for simplifying input state management.

Installation

yarn

yarn add @smooks/use-input

npm

npm i @smooks/use-input

Usage

    import useInput from '@smooks/use-input';

    const validator = (value) => !value.includes("@");
    const name = useInput("Mr.", validator);
    return (
        <div className="App">
            <h1>Hello</h1>
            <input placeholder="Name" {...name.props}/>
        </div>
    );

Argument

Argument Type Description Required
initialValue string The default or initial value set for an input field before user interaction. yes
validator function A custom function used to validate user input, ensuring it meets specific criteria or constraints. yes

Readme

Keywords

Package Sidebar

Install

npm i @smooks/use-input

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

1.95 kB

Total Files

4

Last publish

Collaborators

  • 0724ksm