Accessing the database from PersonalDetails

We can now add database support to our PersonalDetails class. The first thing we are going to do is update the member variables and constructor to bring in the database support and store the list of people we want to display:

  1. First, we add the members:
private readonly dataLayer: Database<PersonRecord>;private people: IPersonState[];
  1. Next, we update the constructor to hook up to the database and create TableBuilder using PersonalDetailsTableBuilder:
const tableBuilder : PersonalDetailsTableBuilder = new PersonalDetailsTableBuilder();this.dataLayer = new Database(tableBuilder.Build());
  1. One thing that we still have to do is add the ability to show people into our render method. In a similar way ...

Get Advanced TypeScript Programming Projects 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.