React Redux Tutorials - 4 - Three Principles

jh22j9·2020년 10월 12일
0

React Redux Tutorials

목록 보기
4/20

Three Principles


  1. The state of your whole application is stored in an object tree within a single store.

    Maintain our application state in a single object which would be managed by the Redux store.

  2. The only way to change the state is to emit an action, an object describing what happened.

    To update the state of your app, you need to let Redux know about that with action.

    Not allowed to directly update the state object.

  3. To specify how the state tree is transformed by actions, you write pure reducers.

    Reducer function - (previousState, action) => newState

Three Principles Overview


JavaScript App이 있다. 이 App의 State는 Redux Store라는 별도의 공간에서 관리한다.

App은 Redux Store를 구독하고 있다. 그러나 App에서 Redux Store의 state를 직접 업데이트 할 수는 없다.

App이 state를 업데이트 하려면 actiondispatch(emit) 해야 한다.

actiondispatch되면 Reducer가 그 action을 처리하여 현재 state를 업데이트 한다.

state가 업데이트되는 즉시 App에 전달된다(subscribe하고 있으므로).

이것이 Redux의 기본 동작 원리이다.

🔗 React Redux Tutorials - 4 - Three Principles

0개의 댓글

관련 채용 정보