Welcome Guest! (App Version 3.1)

websitnero logo name

Store, Reducer, Action

What is Store?

Store is basic repository or variable that contains all the data which is to be used in your entire application. Instead of saving data locally in each component, using concept of Redux, you make a single store and then maintain data inside it so that if you have to change any data just change at one single place and no multiple copies of same variable will be present. Thus, this data inside store becomes single source of truth for the entire application.

Reducer in Redux

Reducer is a simple JavaScript function which follows certain rules. It is the place where any modification related to the application state takes place (this too in a copy of state and not on the original state). A reducer function takes 2 parameters:

  • Action
  • Payload

This function contains a Switch-Case statement which after matching action.type executes code inside respective case block, most often manipulating or updating a copy of current state, and then returns back the modified copy to be used further on in the application.

Action in Redux

Action is a simple object that has a couple fixed properties. The first property is 'type' which defines the type of action. The second is payload which contains data that is to be updated or used by the reducer when this action is passed to the "Reducer Function" (via Dispatch).

WebsiteNero is highly optimized for learning various website developing technlogies. We try our best to add maximum modules and examples to help learn the concepts clearly and vividly. We try to present all content and examples as simple as we can removing any complexity to hurdle easy understanding. We try best provide you with worthful content, but we cannot guarantee full correctness of all the content on this site. While using this website, you agree to have read and accepted all our terms of use and conditions, cookie, and privacy policy. Copyright, 2013-2018 by websitenero.com. All Rights Reserved.