State2 [React] State vs Props 리엑트에서 데이터를 다룰 때 크게 State와 Props이라는 개념을 이용한다. 이번 포스팅에서는 이 둘이 뜻하는 바와 차이점에 대해 알아보자. State란? The state is a built-in React object that is used to contain data or information about the component. state는 컴포넌트에 대한 데이터나 정보를 담는 리엑트 내장 객체다. Props란? Props stand for "Properties." They are read-only components. It is an object which stores the value of attributes of a tag and work similar to the HTML attribu.. 2022. 3. 28. [React] State값을 직접변경하면 안되는 이유 React에서 state값을 변경할 때 항상 강조하는 부분은 State를 직접 변경하면 안 된다는 점이다. React를 처음 배울 때는 시간이 없어서 '그냥 그런갑다~'하고 넘겼지만, 오늘은 조금 깊게 왜 그런지 원리를 알아보고자 한다. 위의 이유를 알기 위해서 우선은 'Shallow Equality Check'에 대한 개념부터 이해해야 한다. Shallow Equality Check Shallow Equality Check 개념은 이전 포스팅에서 다루었던, Shallow copy vs Deep copy와 비슷하다. Shallow compare works by checking if two values are equal in case of primitive types like string, numbers .. 2021. 12. 10. 이전 1 다음