The starter code for this workshop is the solution code to the previous workshop. Your main task will be to refactor this code to use React Router.
- Delete
PageContext.jsx. This will cause a lot of errors, but you can treat those errors like a checklist of things to fix! - Install
react-routerinto the project. - Wrap
<App>in<BrowserRouter>. - Refactor
<App>to use a layout route and define the appropriate routes within. - Refactor
<Layout>,<Navbar>,<Register>, and<Login>to use the appropriate components and hooks fromreact-routerinstead ofPageContext. - Build a new component to use as the page for details about a single activity.
- Each activity in
<ActivityList>should link to its own page. - On that page, the activity's name, description, and creator name should be displayed.
- That component should use
useQueryto grab information about the single activity from the API. - Hint: define the activity ID as a dynamic segment so the component can grab the ID
with
useParams!
- Each activity in
- Move the "delete" buttons from
<ActivityList>into your new page so that logged-in users now need to visit the page for a single specific activity in order to delete it.
Once you have completed all the steps above and you have tested your app to make sure that everyone works, submit your GitHub repository link for the Fitness Trackr Refactor workshop!
Then, if you have extra time, you may continue to the next section: Routines and Sets.