Skip to content

An example of using redux-form along with react, immutable, and redux-immutablejs

Notifications You must be signed in to change notification settings

itaylor/redux-form-immutablejs-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

###redux-form with immutablejs example

Shows how to use redux-form with a store that uses an immutable object as the state object in the store.

###Key parts Using the getFormState option to the reduxForm decorator to transform the immutable state to a JS object

@reduxForm({
  form:'simple',
  fields:['firstName'],
  getFormState: (state, reduxMountPoint) => state.get(reduxMountPoint).toJS()
})

Wrapping the form reducer in a function to transform the form state into an immutable object.

import {reducer as formReducer} from 'redux-form';

export const form = function (state, action) {
  return Immutable.fromJS(formReducer(state, action));
}

###Using

git clone https://github.com/itaylor/redux-form-immutablejs-example.git
cd redux-form-immutablejs-example
npm install
npm start

Then open http://localhost:3000

###Implementation quirks This uses the babel-plugin-transform-decorators-legacy to get decorator support in babel 6.

About

An example of using redux-form along with react, immutable, and redux-immutablejs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published