Close
💰 Wanna get paid the big bucks writing React? Take this quiz and get offers from top tech companies! 💰
- Redux Form
- API
reducer
reducer
#
The form reducer. Should be mounted to your Redux state at
form
.
If you absolutely must mount it somewhere other than
form
, you may provide agetFormState(state)
function to thereduxForm()
decorator, to get the slice of the Redux state where you have mounted theredux-form
reducer.
If you're using Immutablejs to manage your Redux state, you MUST import the reducer from 'redux-form/immutable'.
ES5 Example #
var redux = require('redux');
var formReducer = require('redux-form').reducer;
// Or with Immutablejs:
// var formReducer = require('redux-form/immutable').reducer;
var reducers = {
// ... your other reducers here ...
form: formReducer
};
var reducer = redux.combineReducers(reducers);
var store = redux.createStore(reducer);
ES6 Example #
import { createStore, combineReducers } from 'redux';
import { reducer as formReducer } from 'redux-form';
// Or with Immutablejs:
// import { reducer as formReducer } from 'redux-form/immutable';
const reducers = {
// ... your other reducers here ...
form: formReducer
};
const reducer = combineReducers(reducers);
const store = createStore(reducer);