Redux
사용이유

1. props 문법 귀찮을 때 사용
모든 component가 props 없이 state 직접 꺼낼 수 있다
2. state(변수) 변경 관리할 때 쓴다
상태 관리가 용이 > state 관리가 용이

~~.js 여기에 state 저장 > store
모든 컴포넌트들이 store에서 다 꺼내 쓸 수 있다 > 코드가 짧아진다

컴포넌트들이 state 변경하기 쉬움 > 갑자기 버그가 생겼다 > 버그를 추적 > 컴포넌트 다 찾아봐야 한다 > 시간이 오래 걸린다 > redux 사용하면 > 컴포넌트 수정 방법을 저장소에 다 작성 해둔다 > 컴포넌트들은 수정해달라고 요청만 한다(컴포넌트들은 수정 요청만 할 수 있다 ~~.js에) > 장점 : 버그 찾기 쉽다 > state 관리가 쉽다

state(수정방법) > reducer라고 부른다

컴포넌트에서 state 수정 요청 하려면 dispatch 쓴다.
const dispatch = useDispatch()

<출처 및 참고>

https://www.youtube.com/watch?v=QZcYz2NrDIs&t=322s

https://www.robinwieruch.de/react-redux-tutorial/#what-is-redux

 

React Redux Tutorial for Beginners

A complete React Redux tutorial for beginners: Learn how to build React Redux applications from scratch by following this step by step implementation of an example application ...

www.robinwieruch.de

https://facebookarchive.github.io/flux/docs/in-depth-overview/

 

In-Depth Overview | Flux

Flux is the application architecture that Facebook uses for building client-side web applications. It complements React's composable view components by utilizing a unidirectional data flow. It's more of a pattern rather than a formal framework, and you can

facebookarchive.github.io

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign

 

Object.assign() - JavaScript | MDN

The Object.assign() static method copies all enumerable own properties from one or more source objects to a target object. It returns the modified target object.

developer.mozilla.org

+ Recent posts