© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
D. B. Duldulao, R. J. L. CabagnotPractical Enterprise Reacthttps://doi.org/10.1007/978-1-4842-6975-6_5

5. Navigating React Router

Devlin Basilan Duldulao1   and Ruby Jane Leyva Cabagnot1
(1)
Oslo, Norway
 
This chapter deals with navigation using React Router, a specific library for handling and managing routes within a web app, which we would do so as follows:
  1. 1.

    Create a JavaScript file, router.js, in the root directory. For a TS file, we will use router.tsx.

     
  2. 2.

    Use the Route from react-router-dom to define the path and component associated with the path, for example:

     
<Route path={"/hello"} component={HelloComponent}/>
  1. 3.

    Wrap all the Route that we created inside ...

Get Practical Enterprise React: Become an Effective React Developer in Your Team 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.