import React from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import * as TodoActionCreators from './TodoActionCreators';
class TodoListContainer extends React.Component {
componentDidMount() { //由react-redux注入 let { dispatch } = this.props;
let action = TodoActionCreators.addTodo('Use Redux'); dispatch(action); }
render() {
let { todos, dispatch } = this.props;
//应用bindActionCreator let boundActionCreators = bindActionCreators(TodoActionCreators, dispatch);