Redux

Pascual Vila
Frontend Instructor.
Redux is a predictable state management library for JavaScript applications. It provides a single store that holds the entire application state, and the state can only be modified through actions processed by "reducers".
Example of Redux usage:
{`import { createStore } from "redux";
const initialState = { count: 0 };
function reducer(state = initialState, action) {
switch (action.type) {
case "INCREMENT":
return { count: state.count + 1 };
case "DECREMENT":
return { count: state.count - 1 };
default:
return state;
}
}
const store = createStore(reducer);
store.dispatch({ type: "INCREMENT" });
console.log(store.getState()); // { count: 1 }`}