# @feca-hooks/use-input

> React Hook to create input element faster.

Latest version **1.0.1** (published 2021-02-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @feca-hooks/use-input
pnpm add @feca-hooks/use-input
yarn add @feca-hooks/use-input
bun add @feca-hooks/use-input
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-02-26 |
| First published | 2021-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 2.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | pshtony1 |
| Maintainers | pshtony1 |
| Keywords | react, hooks, hook, input, text |

## Links

- npm: https://www.npmjs.com/package/@feca-hooks/use-input
- Repository: https://github.com/pshtony1/custom-hooks
- Homepage: https://github.com/pshtony1/custom-hooks#readme
- Issues: https://github.com/pshtony1/custom-hooks/issues
- npm.io page: https://npm.io/package/@feca-hooks/use-input

## Dependencies (2)

- [react](https://npm.io/package/react.md) ^17.0.1
- [react-dom](https://npm.io/package/react-dom.md) ^17.0.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-02-26
- 1.0.0 — 2021-02-26

## README

# @feca-hooks/use-input

React Hook to **create input element faster.**

<br />

## How to Install

#### yarn

`yarn add @feca-hooks/use-input`

#### npm

`npm i @feca-hooks/use-input`

<br />

## Usage

### Code

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

function App() {
  // validator must return true/false.
  const validator = () => {
    if (value.length > 10) return false;

    return true;
  }

  const { value, onChange } = useInput("", validator);

  return <input type="text" onChange={onChange} />;
}
```

### Arguments

| **Argument** | **Type** | **Description**                                            | **Required** |
| ------------ | -------- | ---------------------------------------------------------- | ------------ |
| defaultValue | string   | Default value of the input text.                           | no           |
| validator    | function | The callback function validate the input value can change. | no           |

### Return

| **Return value** | **Type** | **Description**                                                                                                                                   |
| ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| Value State      | object   | An object containing the `value`, `onChange`. `value` is current input value. `onChange` is event function executes when input value has changed. |

---
_Source: https://npm.io/package/@feca-hooks/use-input · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
