react-redux-form

WebJar for react-redux-form

License

License

MIT
Categories

Categories

React User Interface Web Frameworks ORM Data
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

react-redux-form
Last Version

Last Version

1.16.13
Release Date

Release Date

Type

Type

jar
Description

Description

react-redux-form
WebJar for react-redux-form
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/davidkpiano/react-redux-form

Download react-redux-form

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/react-redux-form/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>react-redux-form</artifactId>
    <version>1.16.13</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/react-redux-form/
implementation 'org.webjars.npm:react-redux-form:1.16.13'
// https://jarcasting.com/artifacts/org.webjars.npm/react-redux-form/
implementation ("org.webjars.npm:react-redux-form:1.16.13")
'org.webjars.npm:react-redux-form:jar:1.16.13'
<dependency org="org.webjars.npm" name="react-redux-form" rev="1.16.13">
  <artifact name="react-redux-form" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='react-redux-form', version='1.16.13')
)
libraryDependencies += "org.webjars.npm" % "react-redux-form" % "1.16.13"
[org.webjars.npm/react-redux-form "1.16.13"]

Dependencies

compile (7)

Group / Artifact Type Version
org.webjars.npm : shallow-compare jar [1.2.1,2)
org.webjars.npm : prop-types jar [15.5.6,16)
org.webjars.npm : icepick jar [1.1.0,2)
org.webjars.npm : invariant jar [2.2.1,2.3)
org.webjars.npm : lodash.get jar [4.4.2,4.5)
org.webjars.npm : lodash.topath jar [4.5.2,4.6)
org.webjars.npm : react-native-segmented-control-tab jar [3.2.1,4)

Project Modules

There are no modules declared in this project.

React Redux Form

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

⚠️ This project is in maintenance mode only. Please consider using Formik instead.

Read the 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 --save

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

Zero-Boilerplate <LocalForm>

If you want to get up and running with forms quickly without having to set up Redux, just use Local Forms:

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

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

That's all you need. Seriously. Read the Documentation for more information.

NOTE: Please use <LocalForm> with react-redux version 4.x.x or 5.x.x.

Quick Start

For more fine-grained control (such as using custom reducers, storing form state globally, dispatching actions, etc.), you'll want to set up a Redux store for your forms.

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=".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 CodePen or this CodeSandbox for quickly creating reproducible examples!

Versions

Version
1.16.13
1.14.2
1.5.3
1.4.3
1.2.4