Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created April 27, 2016 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/908c495e07e1cd768503d3a11ceb3be1 to your computer and use it in GitHub Desktop.
Save tmcw/908c495e07e1cd768503d3a11ceb3be1 to your computer and use it in GitHub Desktop.
function bookkeeping(state, action) {
// taking the last history item
var newHead = actualReducer(
state.getIn(['history', state.get('historyIndex')]), action)
return state
.set('historyIndex', state.get('historyIndex') + 1)
.update('history', history => history.push(newHead));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment