React-redux connect() cannot wrap component defined as a class extending React.Component

前端 未结 2 1568
离开以前
离开以前 2021-02-19 05:59

I may be missing something, but I can\'t find any example where connect() wraps a component defined as a class (extending React.Component), it always

2条回答
  •  萌比男神i
    2021-02-19 06:48

    You can wrap a React component, whether it's a class or a functional component, with react-redux connect.

    class MyDiv extends React.Component {
      render() {
        return 
    hi
    } } export default connect(({ stateStuff }) => ({ stateStuff }))(MyDiv);

提交回复
热议问题