Yes, we can combine multiple reducers using - combineReducers.
import React, { Component } from "react";
import { createStore, combineReducers } from "redux";
const initialLangState = {
lang_code: "en"
};
const initialUserState = {
user_details: {}
};
const language = (state = initialLangState, action) => {
let newState = { ...state };
if (action.type == "SET_LANGUAGE") {
newState.lang_code = action.lang_code;
}
return newState;
};
const user = (state = initialUserState, action) => {
let newState = { ...state };
if (action.type == "SET_USER") {
newState.user_details = action.user_details;
}
return newState;
};
let rootReducers = combineReducers({
language: language,
user: user,
});
const store = createStore(rootReducers);