Components as classes

The following code snippet declares three components named Container, Row, and Column. These components extend the Component class, which is imported from the React module. There are a few methods that we can implement in a class that extends the Component class, but at a bare minimum, we must implement the render method.

The Container, Row, and Column components are used to control the layout of a page. These components use the CSS classes from the Bootstrap (a library that allow us to style our application with ease) grid system. In Bootstrap, the layout has a maximum of 12 columns, and a different size can be declared for a given screen size:

import * as React from "react"; export class Container extends React.Component ...

Get Learning TypeScript 2.x - Second Edition 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.