Action – capture the intent

An action is something as simple as an intent with accompanying data, that is, a message. How does an action come about though? An action comes about when a user interacts with a UI. The user may select a specific item in a list or a press a button with the intention of submitting a form. Submitting the form should, in turn, lead to a product being created.

Let's look at two different actions:

  • Selecting an item in a list, here we are interested in saving the index of our selected item
  • Saving a todo to a todo list

An action is represented by an object. The object has two properties of interest:

  • The type: This is a unique string that tells us the intention of the action, for example, SELECT_ITEM
  • The data: This ...

Get Architecting Angular Applications with Redux, RxJS, and NgRx now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.