avatar
Published on

Redux μ‹œμž‘ν•˜κΈ° πŸ”₯

Authors
  • avatar
    Name
    Haneul
    Twitter

Redux λ¦¬λ•μŠ€

: λ¦¬μ•‘νŠΈλ₯Ό μœ„ν•œ μŠ€ν…Œμ΄νŠΈ λ§€λ‹ˆμ§€λ¨ΌνŠΈ 툴 (λ³΅μž‘ν•œ μ•±μ—μ„œ 효율적, λ‹¨μˆœν•œ μ•±μ—μ„œ ν•„μš”μ—†μŒ)

Why do we need it? μ™œ ν•„μš”ν•œκ°€?

  1. Components have local state, but apps have global state.
  2. Sometimes state need to be shared.
  3. We need to save the shared state somewhere.
  4. Redux == state container

Redux is a gloabl state container

  1. Ther Redux Store is like a box
  2. We go and grab what we need for the container
  3. For example, from <Navigation/> we only grab the username

Stuff to remember

  1. The whole state of your app is stored in an object(store)
  • state κ°€ λ³΅μž‘ν•˜κ³  컀질 수 μžˆμ–΄μ„œ λ¦¬λ•μŠ€λŠ” ν•΄λ‹Ή 였브젝트λ₯Ό μˆ˜μ •ν•˜λŠ” 것에 맀우 엄격함
  1. If you wanna change the data inside of this object you need to 'dispatch' (sned) an action
  • 였브젝트의 데이터λ₯Ό μˆ˜μ •ν•˜λŠ” 방법은 μ•‘μ…˜μ„ reducer 둜 보내면 κ°€λŠ₯함
  1. You will send this actions to a reducer and this reducer will change the object for you.
  • reducer λŠ” μ‚¬μš©μžλ₯Ό λŒ€μ‹ ν•΄ 였브젝트λ₯Ό 변경함

nomad coders κ°•μ˜ μ°Έκ³ 







μ°Έκ³  : https://haneullee.tistory.com/4?category=689534