An action is a plain object that represents an intention to change the
state. Actions are the only way to get data into the store. Any data,
whether from UI events, network callbacks, or other sources such as
WebSockets needs to eventually be dispatched as actions.
Actions must have a type field that indicates the type of action being
performed. Types can be defined as constants and imported from another
module. It's better to use strings for type than Symbols because strings
are serializable.
Other than type, the structure of an action object is really up to you.
If you're interested, check out Flux Standard Action for recommendations on
how actions should be constructed.
An action is a plain object that represents an intention to change the state. Actions are the only way to get data into the store. Any data, whether from UI events, network callbacks, or other sources such as WebSockets needs to eventually be dispatched as actions.
Actions must have a
type
field that indicates the type of action being performed. Types can be defined as constants and imported from another module. It's better to use strings fortype
than Symbols because strings are serializable.Other than
type
, the structure of an action object is really up to you. If you're interested, check out Flux Standard Action for recommendations on how actions should be constructed.