React - 리액트에서의 shallow compare 부터 React.PureComponent 까지
React:리액트에서의 shallow compare부터 React.PureComponent 까지 | 상황 this.state = { someValue: true }; this.setState({ someValue: true });리액트를 사용하여 개발할때, 위와 같은 상황에서는, setState는 무조건적으로 state를 업데이트하게 되고, 그에 따른 불필요한 렌더링을 하게 됩니다. 따라서 이를 방지하기 위해, 아래와 같이 1. React.PureComponent2. shouldComponentUpdate 주기를 기존 클래스컴포넌트에 추가 를 적용시켜 문제를 해결할수 있습니다. | Shallow compare란?shallow compare는 equality를 체크하는것입니다.숫자나 문자열 같은 sca..
Front end/React
2018. 12. 1. 17:45