Inflearn Community Q&A
useSeletor의 개념 관련 질문드려요
Resolved
Written on
·
324
0
안녕하세요 제로초님 강의를 듣다 헷갈리는 부분이 있어서 질문드립니다.
Applayout에서 useSelector를 사용해서 reducers/index에 있는 initialState 중 필요한 값을 가져온 뒤
UserPordile, LoginForm에서 dispatch를 하셨는데
UserProfile, LoginForm은 어떻게 Applayout에서 가져온 initialState 값에 접근할 수 있는건가요?
UserProfile, LoginForm이 Applayout의 return부분에 있어서 가능한건가요?
expressreactnodejsreduxNext.js
Answer 1
0
zerocho
Instructor
질문이 조금 이해가 안 되는데요. UserProfile이랑 LoginForm은 AppLayout에서 initialState를 가져온 적이 없습니다.
UserProfile이랑 LoginForm은 그냥 useSelector를 통해 리덕스로부터 데이터를 가져오는 겁니다.





바쁘실텐데 답변 감사합니다. 제가 질문의 의도를 잘 표현하지 못한것같습니다.
AppLayout에서 아래 코드를 통해 state를 가져오는 이유가 궁금해서 질문드렸습니다.
UserProfile이랑 LoginForm에서 dispatch를 통해 action을 수행하셨는데
AppLayout에서 state를 가져오지 않은 상태에서 dispatch만을 통해 중앙저장소에 있는 state의 값을 변경할 수는 없는건가요?
만약에 변경할 수 없다면 UserProfile, LoginForm이 아닌 AppLayout에서 state를 가져오는 이유가 궁금합니다