# redux-form-lite

> A simple form management for Redux & React.

Latest version **0.8.1** (published 2017-01-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install redux-form-lite
pnpm add redux-form-lite
yarn add redux-form-lite
bun add redux-form-lite
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.1 |
| Published | 2017-01-06 |
| First published | 2016-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | oreqizer |
| Maintainers | oreqizer |
| Keywords | form, forms, redux, react |

## Links

- npm: https://www.npmjs.com/package/redux-form-lite
- Repository: https://github.com/oreqizer/redux-form-lite
- Homepage: https://github.com/oreqizer/redux-form-lite#readme
- Issues: https://github.com/oreqizer/redux-form-lite/issues
- npm.io page: https://npm.io/package/redux-form-lite

## Dependencies (1)

- [ramda](https://npm.io/package/ramda.md) ^0.23.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.8.1 (latest) — 2017-01-06
- 0.8.0 — 2017-01-06
- 0.7.0 — 2017-01-05
- 0.6.0 — 2017-01-05
- 0.5.14 — 2017-01-04
- 0.5.13 — 2017-01-04
- 0.5.12 — 2017-01-04
- 0.5.11 — 2017-01-04
- 0.5.10 — 2017-01-04
- 0.5.9 — 2017-01-04
- 0.5.8 — 2017-01-04
- 0.5.7 — 2017-01-03
- 0.5.6 — 2017-01-03
- 0.5.5 — 2017-01-02
- 0.5.4 — 2017-01-02
- … 7 more at https://npm.io/package/redux-form-lite/versions

## README

# redux-forms

[![Build Status](https://travis-ci.org/oreqizer/redux-forms.svg?branch=master)](https://travis-ci.org/oreqizer/redux-forms)
[![codecov](https://codecov.io/gh/oreqizer/redux-forms/branch/master/graph/badge.svg)](https://codecov.io/gh/oreqizer/redux-forms)

A simple form manager for **Redux**. Bindings available for **React**!

### Packages

* `redux-forms` [![npm](https://img.shields.io/npm/v/redux-forms.svg)](https://www.npmjs.com/package/redux-forms)
* `redux-forms-react` [![npm](https://img.shields.io/npm/v/redux-forms-react.svg)](https://www.npmjs.com/package/redux-forms-react)

## Size

* `redux-forms` alone is **7kb** gzipped.
* `redux-forms-react` is **10kb** with `redux-forms` included!

**Dependencies**

* Ramda

The build process includes `babel-plugin-ramda`, so no unnecessary functions get into your bundle!

## Installation

Simply:

`yarn add redux-forms`

Or:

`npm i redux-forms --save`

Then just install bindings for any UI library you prefer.

## Quickstart

Mount the `redux-forms` reducer to your root reducer as `reduxForms`.

```js
import { createStore, combineReducers } from 'redux';
import reduxFormsReducer from 'redux-forms';

const rootReducer = combineReducers({
  // ... your other reducers
  reduxForms: reduxFormsReducer,
});

const store = createStore(rootReducer);
```

Create a component wrapped in the `field` decorator.

```js
import { field } from 'redux-forms-react';

const Input = props => (
  <input type="text" {...props.input} />
);

export default field(Input);
```

Then simply wrap your desired form with the `Form` component and you're ready to go!

```js
import { Form } from 'redux-forms-react';

import Input from './Input';

const MyForm = props => (
  <Form name="contact">
    <div>
      <label htmlFor="name">Name</label>
      <Input name="name" />
    </div>
    <div>
      <label htmlFor="email">Email</label>
      <Input name="email" />
    </div>
    <button type="submit">Submit</button>
  </Form>
);

export default MyForm;
```

That's it! This is how you mount the most basic form. For more advanced usage, check out the API docs below.

## Documentation

* [reducer](https://oreqizer.gitbooks.io/redux-forms/content/reducer.html)
* [Form](https://oreqizer.gitbooks.io/redux-forms/content/form.html)
* [field](https://oreqizer.gitbooks.io/redux-forms/content/field.html)
* [fieldArray](https://oreqizer.gitbooks.io/redux-forms/content/fieldarray.html)
* [selectors](https://oreqizer.gitbooks.io/redux-forms/content/selectors.html)
* [actions](https://oreqizer.gitbooks.io/redux-forms/content/actions.html)

## Migrating from 0.11.x

The API in `redux-forms-react` for `Field` and `FieldArray` changed from the `0.11.x` version. The reasons are:

* less magic with supplied props
* better type support in both _TypeScript_ and _Flow_
* easier unit testing
* less overhead with imports

### Field -> field

The `Field` higher order component changed to a `field` decorator. 

> Note: native components are no longer supported, you have to provide a regular component.

This is how you upgrade your fields:

**Before:**
```js
// Input.js
const Input = props => (
  <input type="text" {...props.input} />
);

export default Input;

// MyForm.js
const MyForm = props => (
  <Form name="contact">
    <div>
      <label htmlFor="name">Name</label>
      <Field name="name">
        <Input />
      </Field>
    </div>
    <button type="submit">Submit</button>
  </Form>
);
```

**After:**
```js
// Input.js
const Input = props => (
  <input type="text" {...props.input} />
);

export default field(Input);

// MyForm.js
const MyForm = props => (
  <Form name="contact">
    <div>
      <label htmlFor="name">Name</label>
      <InputField name="name" />
    </div>
    <button type="submit">Submit</button>
  </Form>
);
```

### FieldArray -> fieldArray

The `FieldArray` higher order component changed to a `fieldArray` decorator.

This is how you upgrade your field arrays:

**Before:**
```js
// Inputs.js
const Inputs = props => (
  <div className="Inputs">
    {props.fields.map(id => (
      <Field key={id} name={id}>
        <Input />
      </Field>
    ))}
    <button className="Inputs-btn" onClick={props.fields.push}>
      Add field
    </button>
  </div>
);

export default Inputs;

// MyForm.js
const MyForm = props => (
  <Form name="contact">
    <FieldArray name="name">
      <Inputs />
    </FieldArray>
    <button type="submit">Submit</button>
  </Form>
);
```

**After:**
```js
// Inputs.js
const Inputs = props => (
  <div className="Inputs">
    {props.fields.map(id => (
      <InputField key={id} name={id} />
    ))}
    <button className="Inputs-btn" onClick={props.fields.push}>
      Add field
    </button>
  </div>
);

export default fieldArray(Inputs);

// MyForm.js
const MyForm = props => (
  <Form name="contact">
    <InputsArray name="name" />
    <button type="submit">Submit</button>
  </Form>
);
```

## License

MIT

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