개발하자(DevHaja)

FrontEnd/React & React-Native

[React] State

📝 state state는 Component 내부에서 바뀔 수 있는 값을 의미합니다. props는 Component가 사용되는 과정에서 부모Component가 설정하는 값이며, component 자신은 해당 props를 읽기 전용으로만 사용할 수 있습니다. props를 바꾸려면 부모 Componenet에서 바꾸어 주어야합니다. React에는 두 가지 state가 있습니다. 하나는 class형 Component가 지니고 있는 state이고, 다른 하나는 함수형 Component가 지니고 있는 useState라는 함수를 통해 사용하는 state입니다. 📜 class형 Component의 state - Component에 state를 설정할 때는 constructor 메서드를 작성하여 설정합니다. constu..

devwoodie
'State' 태그의 글 목록