Nicely Presented Misnomer

    @ej-hooks/use-input

    1.0.0 • Public • Published

    @ej-hooks/use-input

    React Hook to update input with validator.

    Installation

    yarn

    yarn add @ej-hooks/use-input

    npm

    npm i @ej-hooks/use-input

    Usage

    import React from 'react';
    import useInput from '@ej-hooks/use-input';
    function App() {
      const maxLen = (value) => value.length <= 10;
      //const noAt = (value) => !value.includes('@');
      const name = useInput('Mr.', maxLen);
      return <input placeholder="Name" {...name} />;
    }

    Arguments

    Argument Type Description Required
    initialValue string Initial input value yes
    validator function Function to validate the input value no

    Install

    npm i @ej-hooks/use-input

    DownloadsWeekly Downloads

    4

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    1.94 kB

    Total Files

    4

    Last publish

    Collaborators

    • eunjinfizz