react-dev-tools로 컴포넌트 구조를 확인하거나 렌더링 프로파일링 가능

버벅거리거나 시간이 오래걸리는 경우 속도를 측정해보고 shouldComponentUpdate를 이용하여 불필요한 렌더링을 방지한다.

// TodoList.js

class TodoList extends Component {
    shouldComponentUpdate(nextProps, nextState) {
        return this.props.todos != nextProps.todos;
    }
    ...
}
// TodoItem.js

class TodoItem extends Component {
    shouldComponentUpdate(nextProps, nextState) {
        return this.props.done !== nextProps.done;
    }
    ...
}

shouldComponentUpdate을 구현하는 것을 습관화 하자.

주로 다음 상황일 때 리렌더링 최적화가 필요하다.

리덕스 개념 이해