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 BrowserRouter, Header, 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access