freeCodeCamp/guide/english/redux/redux-actions/index.md

1.2 KiB

title
Redux Actions

Redux Actions

Redux action is a simple object that describes what sort of event has happened in your application. They can even contain data that needs to be sent from the application to the Redux store. An action can contain anything but it must have a mandatory type property which describes the event taking place. A good practice is to use constants while describing the action.

For example

const ADD_ITEM = 'ADD_ITEM'
{
 type: ADD_ITEM,
 text: 'This is the first item'
}

We can send these actions to the store by using

store.dispatch()

An application can have different sorts of events happening at a time and these actions help describe these events. Without these actions there is no way to change the state of the application.

You might try redux-actions project that reduces lot of boilerplate making writing your actions way faster.

More Information:

Actions-Redux Offical Docs redux-actions github project page