shouldComponentUpdate1 shouldComponentUpdate 메서드 책에 나온 설명을 보면서 이해했다. shouldComponentUpdate(nextProps, nextState) { ... } props 또는 state 를 변경했을 때, 리렌더링을 시작할지 말지를 지정하는 매서드 반드시 true, false 를 반환해야하고, 따로 생성하지 않으면 true 가 default 이 메서드 안에서 현재 props와 state는 this.props 와 this.state로 접근하고, 새로 설정될 props 또는 state는 nextProps 와 nextState로 접근할수 있다. 이 메서드를 잘쓰면 잘쓸수록 프로젝트의 속도 및 성능이 최적화 될것같다. 2021. 4. 22. 이전 1 다음