Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

combineReducers in Redux

In the previous post, we saw about Redux reducers, how to create them, and bind it to the store when the Application gets initialized. This approach of creating and initializing a single Reducer works well for small Applications.

When the application grows it might be difficult to hold the state of all the components in a single file, as it will grow too big making it difficult to maintain, we would like to split the reducer code across different reducer files for maintainability. To achieve this redux provides a utility combineReducers(), this can take multiple reducers and merge them into a single reducer before assigning it to the store.

Let us extend the previous example, add multiple reducers and use combineReducers() to merge them into a single reducer and assign it to the state as follows.


This post first appeared on C# Guide, please read the originial post: here

Share the post

combineReducers in Redux

×

Subscribe to C# Guide

Get updates delivered right to your inbox!

Thank you for your subscription

×