求一个react-redux 当不需要state的时候的一个写法

import { allInfo } from '../../redux/actions/index'
import {connect} from 'react-redux'

class Doem extends Component { ... }

export default connect(
    state => {return state},
    {allInfo}
)(Doem)

当我不需要state属性,只需要使用{allInfo}的方法的时候如何写connect才能不报错呢

export default connect(
    '_',
    {allInfo}
)(BuyerCenter)
export default connect(
    ()=>{},
    {allInfo}
)(BuyerCenter)
export default connect(
    {},
    {allInfo}
)(BuyerCenter)

以上写都会报错
Invalid value of type object for mapStateToProps argument when connecting component Doem

阅读 1.7k
1 个回答

null

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题