- 앱을 개발하다 보면, 유저의 인풋에 따라 화면을 업데이트 해야 하는 경우가 있다. 예를들면 이미지 갤러리 화면에서 특정 이미지를 클릭하면 활성화 표시가 된다던지 하는 경우 말이다.
- 리액트에서, 변화할 수 있는 데이터는 state라고 한다. state는 어떤 컴포넌트에도 추가할 수 있고, 필요에 따라 업데이트 할 수 있다. 리액트에서는 이 state를 활용하여 유저 인풋에 반응react하는, 즉 상호작용interact하는 UI를 만들 수 있다.
- 이 챕터는 상호작용이 가능한 컴포넌트를 만들고, state를 업데이트 하고, 그에 따라 화면에 다른 결과를 표시하는 방법을 다룬다.
1. How to handle user-initiated events (Responding to events)
2. How to make components “remember” information with state (State: a component’s memory)
3. How React updates the UI in two phases (Render and commit)
4. Why state doesn’t update right after you change it (State as a snapshot)
5. How to queue multiple state updates (Queueing a series of state updates)
6. How to update an object in state (Updating objects in state)
7. How to update an array in state (Updating arrays in state)