Create forms easily in React with Redux.
JavaScript
Latest commit 1617256 Oct 2, 2016 @davidkpiano committed on GitHub Merge pull request #435 from erin-doyle/immutable_control_component
Immutable control component
Permalink
Failed to load latest commit information.
docs Fixing validity reset issue where getFieldFromState always returned a… Sep 29, 2016
examples Performance improvements (WIP) Addresses #427 Oct 1, 2016
src Cleaned up eslint findings Oct 2, 2016
test Cleaned up eslint findings Oct 2, 2016
.babelrc Optimizations: adding webpack externals for React, React-Redux, Redux… May 13, 2016
.bookignore Updating book files Sep 26, 2016
.editorconfig Added eslint and airbnb-config packages, eslintrc, eslintignore, and … Feb 25, 2016
.eslintignore Updating book files Sep 26, 2016
.eslintrc Updating various eslint packages Jul 13, 2016
.gitignore Updating book files Sep 26, 2016
.npmignore Ignoring .babelrc in .npmignore. Fixes #417 Sep 27, 2016
.travis.yml Adding v1 form reducer (WIP) May 25, 2016
LICENSE Initial commit Dec 11, 2015
README.md Update README.md Sep 27, 2016
SUMMARY.md Updating docs Sep 21, 2016
UPGRADE_GUIDE.md Update UPGRADE_GUIDE.md Aug 22, 2016
book.json Omitting react-dom for react native environments. Fixes #415 Sep 27, 2016
contributing.json add contributing.json file (https://gitmagic.io/rules) Apr 13, 2016
esdoc.json Simplifying change reducer (also fixes some edge-case bugs) Sep 5, 2016
immutable.d.ts Added tsdef for lib/immutable Jul 5, 2016
native.js Omitting react-dom for react native environments. Fixes #415 Sep 27, 2016
package.json Add support for react-redux v5 Oct 1, 2016
react-redux-form.d.ts reformat Jul 7, 2016
wallaby.config.js ****TESTS***** moved test from ./lib to ./src. Source compiled regard… Feb 25, 2016
webpack.config.base.js Fixing config Aug 18, 2016
webpack.config.prod.js fix umd build Aug 2, 2016

README.md

React Redux Form

Join the chat at https://gitter.im/react-redux-form/Lobby Build Status npm version

🆕 Read the Documentation

Or, if you're using an old version, read the v0.14.x documentation

React Redux Form is a collection of reducer creators and action creators that make implementing even the most complex and custom forms with React and Redux simple and performant.

npm install react-redux-form@latest --save

Installation

# Dependencies (you probably already have these)
npm install react react-dom redux react-redux redux-thunk --save

# version 1.0.x
npm install react-redux-form@latest --save

Quick Start

Be sure to read the step-by-step quick start guide in the documentation.

import React from 'react';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import { combineForms } from 'react-redux-form';

import MyForm from './components/my-form-component';

const initialUser = { name: '' };

const store = createStore(combineForms({
  user: initialUser,
}));

class App extends React.Component {
  render() {
    return (
      <Provider store={ store }>
        <MyForm />
      </Provider>
    );
  }
}
// ./components/my-form-component.js'
import React from 'react';
import { connect } from 'react-redux';
import { Control, Form } from 'react-redux-form';

class MyForm extends React.Component {
  handleSubmit(val) {
    // Do anything you want with the form value
    console.log(val);
  }

  render() {
    return (
      <Form model="user" onSubmit={(val) => this.handleSubmit(val)}>
        <label>Your name?</label>
        <Control.text model="user.name" />
        <button>Submit!</button>
      </Form>
    );
  }
}

// No need to connect()!
export default MyForm;

Posting Issues

When posting an issue, please include a detailed description along with a relevant code sample. Attaching a failing test case with your issue will go a long way and is much appreciated.

Feel free to fork this esnextb.in gist for quickly creating reproducible examples!