Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jovidecroock/hooked-form

Performant 2KB React library to manage your forms
https://github.com/jovidecroock/hooked-form

forms hooks modern react react-native reactjs

Last synced: 13 days ago
JSON representation

Performant 2KB React library to manage your forms

Awesome Lists containing this project

README

        

# Hooked-Form

[![npm version](https://badgen.net/npm/v/hooked-form)](https://www.npmjs.com/package/hooked-form)
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors)
[![Build Status](https://travis-ci.com/JoviDeCroock/hooked-form.svg?branch=main)](https://travis-ci.com/JoviDeCroock/hooked-form)
[![Bundle size](https://badgen.net/bundlephobia/minzip/hooked-form)](https://badgen.net/bundlephobia/minzip/hooked-form)
[![codecov](https://codecov.io/gh/JoviDeCroock/Hooked-Form/branch/main/graph/badge.svg)](https://codecov.io/gh/JoviDeCroock/Hooked-Form)

[Documentation](https://jovidecroock.github.io/Hooked-Form/)

[Example](https://codesandbox.io/s/sweet-poincare-3km8r4k16)

## 🌍 Installation

**yarn**

```bash
yarn add hooked-form
```

**npm**

```bash
npm i --save hooked-form
```

**UMD**

_dev_:

```html

```

## 🎨 Example

```jsx
import React from 'react';
import { HookedForm, useField } from 'hooked-form';

const StringField = ({ fieldId, label }) => {
const [{ onChange }, { touched, error, value }] = useField(fieldId);
const onInput = React.useCallback(e => onChange(e.currentTarget.value), [
onChange,
]);
return (

{label + ' '}

{touched && error &&

{error}
}

);
};

const App = () => {
return (
({ name: '' }), [])}
validate={values => (values.name ? {} : { name: 'Required' })}
>

Hooked Form





);
};

render(, document.body);
```

## πŸ’Ώ Modern build

This library offers a modern build (ES2015 output), this is smaller and parses faster in the browser.
So if you don't plan to target older browsers feel free to use this.

### Webpack

```json
"resolve": {
"alias": {
"hooked-form": "hooked-form/dist/hooked-form.modern.js"
}
}
```

### Parcel

```json
"alias": {
"hooked-form": "hooked-form/dist/hooked-form.modern.js"
}
```

## πŸ“’ Credits

- [Microbundle](https://github.com/developit/microbundle)
- [Performance-comparison](https://codesandbox.io/s/react-form-library-stress-test-81swz)

## 😍Contributors

Thanks goes to these wonderful people ([emoji key](https://github.com/all-contributors/all-contributors#emoji-key)):



Laurens Lavaert

πŸ’»

Jovi De Croock

πŸš‡ ⚠️ πŸ‘€ πŸ“– πŸ’»

Jonathan Callewaert

πŸ›

Andrew Rempe

πŸ’»

Corentin Leruth

πŸ’»

Pavel Ravits

πŸ›

Tegan Churchill

πŸ›

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!