Managing application state with NgRx
The visitor portal will allow the user to see a list of available POIs and select one to view its location on a map. The list of available POIs and the selection of a POI is the global state of our application. We will integrate NgRx to manage the application state in the visitor portal by completing the following tasks:
- Configuring the state
- Interacting with the store
Let's begin by configuring the state of our application in the following section.
Configuring the state
Our application will consist of a root state for the whole application and a feature state for the visitor portal. We will start by executing the following command to create the root state:
nx generate ngrx app --root --no-interactive --parent=apps/tour/src/app/app.module.ts
The preceding command uses the generate
command of Nx CLI, passing the following options:
ngrx
: Indicates that we want to set up an NgRx stateapp
: The name of the state--root
: Indicates that we want...