Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

React Redux Form v1.2.0

Compare
Choose a tag to compare
@davidkpiano davidkpiano released this 04 Nov 02:44
· 587 commits to master since this release

Local Forms πŸš€

Local Forms are here! If you've ever asked the question:

Why would I want to keep my form state in a global Redux store, when form state is supposed to be local?

then <LocalForm> is for you. Here's what it looks like:

import React from 'react';
import { LocalForm, Control } from 'react-redux-form';

export default class MyApp extends React.Component {
  handleChange(values) { ... }
  handleUpdate(form) { ... }
  render() {
    return (
      <LocalForm
        onUpdate={(form) => this.handleUpdate(form)}
        onChange={(values) => this.handleChange(values)}
      >
        <Control.text model=".username" />
        <Control.text model=".password" />
      </LocalForm>
    );
  }
}

That's right; you don't even need to setup Redux if you're using <LocalForm>. The entire form and model state of your isolated local form are kept in internal component state. Any <Control>, <Errors>, <Field>, etc. will continue to work inside of <LocalForm>.

πŸ‘‰ Read the docs to find out more about <LocalForm>. #420