# react-use-form

> Custom react hook for HTML forms

Latest version **0.1.0** (published 2018-10-26) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install react-use-form
pnpm add react-use-form
yarn add react-use-form
bun add react-use-form
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-10-26 |
| First published | 2018-10-26 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 52.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Colin Barringer |
| Maintainers | colin.barringer |
| Keywords | react, hooks, form |

## Links

- npm: https://www.npmjs.com/package/react-use-form
- Repository: https://github.com/colinthesealion/react-use-form
- Homepage: https://github.com/colinthesealion/react-use-form#readme
- Issues: https://github.com/colinthesealion/react-use-form/issues
- npm.io page: https://npm.io/package/react-use-form

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^16.7.0-alpha.0

## 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

- 0.1.0 (latest) — 2018-10-26
- 0.0.2 — 2018-10-26
- 0.0.1 — 2018-10-26

## README

# react-use-form
Custom react hook for HTML forms

# usage
`npm install --save react-use-form react@^16.7.0-alpha.0 react-dom@^16.7.0-alpha.0`

```
import { Form, Input } from 'react-use-form';

const handleSubmit = (values) => {
  if (values.surname === 'Jetson') {
    return values.name === 'George';
  }
  else {
    return true;
  }
};

const isValidSurname = (surname) => {
  return ['Jetson', 'Flinstone', 'Simpson'].findIndex(surname) >= 0;
};

const MyForm = ({ initialValues }) => {
  return (
    <Form onSubmit={handleSubmit}>
      <Input InputAs="input" name="name" />
      <Input InputAs="input" name="surname" validate={isValidSurname} />
      <button type="submit">Submit</button>
    </Form>
  );
};

export default MyForm;
```

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