14.05 Setting Up Reducer And Store
Installing Redux
- npm
- Yarn
npm install --save redux
yarn add redux
New redux-basics.js
redux-basics.js
const redux = require("redux");
const createStore = redux.createStore;
const initialState = {
counter: 0,
};
// Reducer
const rootReducer = (state = initialState, action) => {
return state;
};
// Store
const store = createStore(rootReducer);
console.log(store.getState());
// Dispatching Action
// Subscription