Working with the react-router

In the preceding section, we learned how to use the render method from the react-dom module to render the Layout component. In this section, we are going to take a closer look at the Layout component.

As we can see in the code snippet below, the Layout component is a function that returns a series of nested JSX elements; some of these JSX elements are other React components (such as BrowserRouterHeader, and Switch components). This is the first time that we have seen the actual implementation of a React component. In this case, a React component is a function that returns some JSX. However, it is important to mention that this is not always the case as a component can also be a class.

React is a component-based ...

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.