1.0.0 • Published 3 years ago

@practical-react-hooks/use-input v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@practical-react-hooks/use-input

React Hook to update your document's input.

Installation

yarn

yarn add @practical-react-hooks/use-input

npm

npm i @practical-react-hooks/use-input

Usage

import React from "react";
import useInput from "@practical-react-hooks/use-input";

const App = () => {
  const validator = value => value.length < 30;
  const name = useInput("Mr./Ms.", validator);
  return (
    <div className="App">
      <h1>Hello</h1>
      <input placeholder="Name" {...name} />
    </div>
  );
};

Arguments

ArgumentTypeDescriptionRequired
initialValuestringinitial Value you want to use on inputno
validatorfunctionThe function you want to valid input value and The function that return booleanno