./src/productsection.js尝试导入错误:未从“ redux”导出“ bindActionCreaters”

时间:2020-04-19 17:36:36

标签: javascript reactjs redux

这是我遇到的错误,请帮忙。我通过互联网查询,却找不到任何东西

./src/productsection.js Attempted import error: 'bindActionCreaters' is not exported from 'redux'.

import React from 'react';
import { connect } from 'react-redux';
import { bindActionCreaters } from 'redux';

function Products({users}) {
  function displayitem(){
    return users.map((user) => {
      return (
        <button onClick={()=>users.selectUser(user)}>Add to cart </button>
     </div>
      );
    });
  }

  return (
    <div>
      { displayitem() }
    </div>
  );
}

function mapStatetoProps(state){
  return {
    users: state.users ,
  };
}

function mapDispatchToProps(dispatch) {
  return bindActionCreaters({ selectUser: selectUser }, dispatch);
}

export default connect(mapStatetoProps, mapDispatchToProps)(Products);

1 个答案:

答案 0 :(得分:0)

将bindActionCreaters重命名为bindActionCreators