To rely on React Router's loader() and action() instead of using useNavigate() when rendering the component.
📚 Context
It is a recommendation of react-router docs:
But... why?
The data fetching will happen before the render starts, which means better loading times:
As the user navigates around the app, the loaders for the next matching branch of routes will be called in parallel and their data made available to components through useLoaderData.
By moving logic to loaders and actions, we can manage the loading and error states with react-router utilities instead of in-house logic.
We decouple the rendering logic from the data fetching logic.
Technical refinement
WIP
I plan to get deeper into current implementation of octokit-provider's. Concretely how we are managing the authentication context. The idea is to see what's a good approach to move things out of useContext() and rely on loader() and action() instead.
Expected Output
To rely on React Router's
loader()
andaction()
instead of usinguseNavigate()
when rendering the component.📚 Context
It is a recommendation of
react-router
docs:But... why?
loaders
andactions
, we can manage the loading and error states withreact-router
utilities instead of in-house logic.Technical refinement
WIP
I plan to get deeper into current implementation of
octokit-provider
's. Concretely how we are managing the authentication context. The idea is to see what's a good approach to move things out ofuseContext()
and rely onloader()
andaction()
instead.