How to use Redux's Provider with React

前端 未结 2 548
一向
一向 2020-12-13 03:55

I\'ve been following the ReduxJS documentation here: Usage with React

At the end of the document it mentions usage of the provider object, I have wrapped my App com

2条回答
  •  情歌与酒
    2020-12-13 04:31

    Thanks for the answer, but it is missing one crucial bit, which is actually in the documentation.

    If contextTypes is not defined, then context will be an empty object.

    So I had to add the following for it to work for me:

      static contextTypes = {
        store: PropTypes.object.isRequired
      }
    

提交回复
热议问题