react/ shouldComponentUpdate()

JIWON LEE·2021년 4월 1일

shouldComponentUpdate()에 대해 들어보셨나요?


이것은 리액트에서 렌더링 되는 시점을 조작해서 최적화를 하는데 사용하는 함수입니다

이전에 react lifecycle에 대해서 알아야한다

컴포넌트 생성시 constructor > componentWillMount > render > componentDidMount 순으로 진행된다.

컴포넌트 제거시에는 componentWillUnmount가 실행

컴포넌트의 prop이 변경될 떼엔 componentWillReceiveProps > shouldComponentUpdate > componentWillUpdate > render > componentDidUpdate 순으로 진행된다

profile
포기잘하는 프론트엔드 개발자

0개의 댓글