Skip to main content

14.05 Setting Up Reducer And Store

Installing Redux

npm install --save 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