Skip to content

Instantly share code, notes, and snippets.

@kabbi
Last active May 19, 2017 12:29
Show Gist options
  • Save kabbi/d126df2b65c918384825500a6e303b5d to your computer and use it in GitHub Desktop.
Save kabbi/d126df2b65c918384825500a6e303b5d to your computer and use it in GitHub Desktop.
import { createStore, applyMiddleware } from 'redux';
import { actions, combineForms, getField } from 'react-redux-form';
import thunk from 'redux-thunk';
const formsReducer = combineForms({
user: { arr: [] },
});
const store = createStore(formsReducer, applyMiddleware(thunk));
store.dispatch(actions.push('user.arr', { id: 42 }));
console.log('Before:', getField(store.getState(), 'user.arr'));
store.dispatch(actions.remove('user.arr', 0));
console.log('After:', getField(store.getState(), 'user.arr'));
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"redux": "3.6.0",
"react-redux-form": "1.11.1",
"redux-thunk": "2.2.0",
"babel-runtime": "6.23.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment