-
Notifications
You must be signed in to change notification settings - Fork 293
Actions
Haz edited this page Apr 1, 2017
·
14 revisions
Actions are plain objects dispatched by the application (usually from containers
) to describe changes on the store. Reducers
and sagas
listen to it so they can perform state changes and side effects, respectively, within the store.
A simple action would look like:
{ type: 'RESOURCE_UPDATE', id: 1, title: 'Hi!' }
ARc uses action types and action creators to create those action objects:
const RESOURCE_UPDATE = 'RESOURCE_UPDATE'
const resourceUpdate = body => ({
type: RESOURCE_UPDATE,
...body,
})
That way, other parts of the app, usually containers, can dispatch that action:
Special thanks to @kybarg and @protoEvangelion for helping to write this Wiki. Please, feel free to edit/create pages if you think it might be useful (also, see #33)