

This React tutorial is part 14 of 17 in the React for beginners series. With this architecture, we’ll discuss how to create multiple routes within this single div wrapper and navigate between them using React router.

If we recall how we build a React project, we usually render the root component (containing the app’s content) in a single div element in an index.html file.Įvery internal page (or route) a user will navigate is within that single div wrapper. React application will load a single HTML page alongside necessary assets, including CSS and JavaScript, to render the user interface. In a conventional multi-page website, the server can return the HTML file for a requested page for the browser to create a DOM tree. It lets us use third-party solutions like React Router, Wouter, TanStack Router, etc., to keep track of the current URL and render content based on the URL. Naturally, React does not have a routing capability like Angular and other frameworks. Editor’s note: This React Router tutorial was last updated on February 2023 to use the React router dom v6.Ī routing system provides a mechanism to navigate between different parts of an application.
