A Store is an Object which holds the whole state tree of your application.
import React, { Component } from "react";
import { createStore } from "redux";
const initialState = {
lang_code: "en",
};
const langReducer = (state = initialState, action) => {
//make a copy of initialState
//(you can also use - Object.assign({}, state))
let newState = {...state};
if (action.type === "SET_LANGUAGE") {
newState.lang_code = action.lang_code;
}
return newState;
};
const store = createStore(langReducer);