ReactJs/Redux Invariant Violation: Could not find “store” in either the context or props of “Connect(LoginContainer)”

后端 未结 3 1497
深忆病人
深忆病人 2021-02-20 11:13

Not sure why I\'m getting this error, it happened when I added connect from redux to my Login component, so I could connect my store.

3条回答
  •  日久生厌
    2021-02-20 11:38

    You could use React's contextType or pass propType. You would need to declare it either as a prop or contextType.

    Provider.contextTypes = {
      Store: React.PropTypes.object.isRequired
    };
    
     Provider.propTypes= {
      Store: React.PropTypes.object.isRequired
    };
    

提交回复
热议问题