Adding the component

This one comes in two parts, the HTML template and the class file. Let's start with the class file:

// counter/counter-list/counter-list.component.tsimport { Component, OnInit } from "@angular/core";import { AppState } from "../../app-state";import { Store } from "@ngrx/store";import { addItem, removeItem } from "./counter-list.actions";@Component({  selector: "app-counter-list",  templateUrl: "./counter-list.component.html",  styleUrls: ["./counter-list.component.css"]})export class CounterListComponent implements OnInit {  list$;  newItem: string;  counter: number;  constructor(private store: Store<AppState>) {    this.counter = 0;    this.list$ = this.store.select(state => state.counter.list);  }  ngOnInit() {}  add() {    this.store.dispatch(addItem( ...

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.