-
[11]State를 직접적으로 업데이트 하면 안되는 이유dev/Web 2021. 4. 12. 19:03
state의 값을 직접 업데이트하면 구성 요소가 다시 렌더링 되지 않는다.
그렇기 때문에 setState를 사용해서 state의 값을 업데이트 할 수 있다.
setState를 사용하면 해당하는 state의 값을 업데이트 한 후 구성 요소를 다시 렌더링하여 응답한다.
'dev > Web' 카테고리의 다른 글
[13]HTML과 React 이벤트 처리의 차이점 (0) 2021.04.12 [12]setState()의 인수로서 콜백 함수의 목적 (0) 2021.04.12 [10]State와 Props의 차이 (0) 2021.04.12 [9]React에서 Prop은 무엇인가? (0) 2021.04.12 [8]React에서 state는 무엇인가? (0) 2021.04.12