GoConqr has a new look! Let us know what you think.

Module 6 of 18 · Media

Create actions

Kostas Diakogiannis

Create actions

Let's create some actions

Let's create some actions. Until now we now, that there are two types of operations we would like to happen. The deposit action, and the withdraw action.

Actions are actually objects that are returned from functions. These functions can be called whenever we want and we can associate them with an event (click of a mouse etc). But for now as you can see above they return always an object with a type property that accepts a string, and additional properties that represent values of data that will be passed to the reducer.

In our case, think that the type property is a mandatory property because the reducer (the father or the manager) must somehow recognize which type of operation it must execute. This piece of info it is stored in a form of a string inside the type property of an action object. The other properties are optional, but in this case we would like also to pass not only the name of the action that should be dispatched but also the amount of money that should be either deducted from the balance (state) or added there.

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?