adding a redux todo list to playground

This commit is contained in:
Ken
2019-01-24 12:56:23 -08:00
parent 8b0a0f7569
commit a61d89ea14
12 changed files with 212 additions and 16 deletions

View File

@@ -0,0 +1,24 @@
import * as actions from '../actions';
import { Store } from '../store';
import { connect } from 'react-redux';
import { Dispatch } from 'redux';
import { TodoApp } from './TodoApp';
export function mapStateToProps({ todos, filter }: Store) {
return {
todos,
filter
};
}
export function mapDispatchToProps(dispatch: Dispatch<actions.TodoAction>) {
return {
add: (label: string) => dispatch(actions.add(label)),
remove: (id: string) => dispatch(actions.remove(id))
};
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(TodoApp);