November 2019
Beginner
804 pages
20h 1m
English
The renderBook method will add the given book to the DOM of the corresponding collection. This is done using the identifiers that we defined earlier. As you can see, they're necessary and central to application code:
renderBook(collectionIdentifier: string, book: Book): void {
if (!book) {
throw new Error("The book to render must be provided!");
}
const collectionTableBody = document.getElementById (`collectionTableBody-${collectionIdentifier}`) as HTMLTableSectionElement;
if (!collectionTableBody) {
throw new Error(`The table body for collection ${collectionIdentifier} could not be found! Was the template changed?`);
}
const tableRow: HTMLTableRowElement = collectionTableBody.insertRow(); tableRow.id ...Read now
Unlock full access