- Install React Router
- Create a browser router with a root route and 2 children routes in
index.js
, and render theRouterProvider
instead of theApp
component. - The root route will be rendering the
App.js
element. - One of the children routes will be an
index
route, rendering theHome.js
element. - The other will be at the
/lab
path, rendering theLab.js
element. - in
App.js
, create navigation links that allow switching between the two pages
- Write a loader in the Lab.js file, that loads todo data using the mock library in
src/data/index.js
- Use the loader in the route definition for the Lab page
- Render the todo list data in the Lab component, using
<ul>
and<li>
elements
- Write an action in the Lab.js file, that adds a new todo to the list (using the mock library)
- Use the action in the route definition for the Lab page
- Render a form in the Lab component, that triggers the action when submitted
- Add a new components called
Bouncer.js
andTrigger.js
to thesrc/components
folder - Add children routes to the Lab page, that renders the
Trigger
and an index page, andBouncer
under the/bouncer/:name
path - Use Outlet in the Lab component to render the children
- In the Trigger component get a random name from the mock library (
randomName()
) and render a link that navigates to the Bouncer pagebouncer/${name}
- In the Bouncer component, render the name from the route params
- In the Bouncer component, use the
useNavigation
anduseEffect
hooks to navigate back to the Lab page after 2 seconds