Skip to content

Commit

Permalink
change redux-undo api usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ntedgi committed May 8, 2019
1 parent 344d0e2 commit 333ec09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions examples/todos-with-undo/src/containers/UndoRedo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { ActionCreators as UndoActionCreators } from 'redux-undo'
import { ActionCreators } from 'redux-undo';
import { connect } from 'react-redux'

let UndoRedo = ({ canUndo, canRedo, onUndo, onRedo }) => (
Expand All @@ -12,17 +12,16 @@ let UndoRedo = ({ canUndo, canRedo, onUndo, onRedo }) => (
</button>
</p>
)

const mapStateToProps = (state) => ({
canUndo: state.todos.past.length > 0,
canRedo: state.todos.future.length > 0
canUndo: state.todos.present.length > 0,
canRedo: state.todos.history.length > 0
})


const mapDispatchToProps = ({
onUndo: UndoActionCreators.undo,
onRedo: UndoActionCreators.redo
onUndo: ActionCreators.undo,
onRedo: ActionCreators.redo
})

UndoRedo = connect(
mapStateToProps,
mapDispatchToProps
Expand Down
2 changes: 1 addition & 1 deletion examples/todos-with-undo/src/reducers/todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ const todos = (state = [], action) => {
}
}

const undoableTodos = undoable(todos, { filter: includeAction(['ADD_TODO', 'TOGGLE_TODO']) })
const undoableTodos = undoable(todos )

export default undoableTodos

0 comments on commit 333ec09

Please sign in to comment.