복붙노트

[REACTJS] mapStateToProps와 연결 사용할 때지도 '정의의' '속성을 읽을 수 없습니다'

REACTJS

mapStateToProps와 연결 사용할 때지도 '정의의' '속성을 읽을 수 없습니다'

해결법


  1. 1.렌더링하는 동안 당신은 연결 구성 요소를 사용하지 않는 따라서 소품은 구성 요소에서 사용할 수 없습니다

    렌더링하는 동안 당신은 연결 구성 요소를 사용하지 않는 따라서 소품은 구성 요소에서 사용할 수 없습니다

    const ConnectedDumb = connect(
      data,
      null
    )(Dumb);
    
    class Container extends React.Component {
      render() {
        return (
          <div>
            <ConnectedDumb />
          </div>
        );
      }
    }
    

    작업 데모

  2. from https://stackoverflow.com/questions/52626245/cannot-read-property-map-of-undefined-when-using-connect-with-mapstatetoprop by cc-by-sa and MIT license