1. 2
    Redux: Describing State Changes with Actions
    2m 54s

Redux: Describing State Changes with Actions

InstructorDan Abramov

Share this video with your friends

Send Tweet

You will learn how Redux asks you to describe every change in the application state as a plain JavaScript object called “action”.

We are presenting a “complete” example in the code window below. Feel free to click around and explore! We will be explaining what everything does during this course.

Alex
~ 7 years ago

What are the benefits of dispatching actions to change the state? Why can you not modify or write to the state? Also, what are the benefits of having a serializable value in the type property of an action?

Dirk
~ 7 years ago

Why is an id needed for action ADD_TODO? An action should be minimal? In my opinion, the new id should be generated by looking at current state, so in the reducer, not in the action.

Correct?

Shipsy
~ 6 years ago

What are the benefits of dispatching actions to change the state? Why can you not modify or write to the state? Also, what are the benefits of having a serializable value in the type property of an action?

Nice question. Making actions the mode of interacting with the state makes development declarative. You don't have to explicitly say 'make an array, sort it, then do this' - you just say 'CREATE_ORDERS' or something intuitive like that. It makes the development process so much easier - future developers need not know how the state change is being implemented as long as the actions work. Plus, you minimize the chances of fucking up your state when you allow only reducers to manipulate it.