react-router-guards
react-router-guards copied to clipboard
V2 Internals Rewrite
Description
This introduces a rewrite of the react-router-guards
internals, with some public-facing API changes
This builds on top of #84, #85, #98, and #99 to make the following changes:
- routes changes are detected by a change in
route.match
(not location) - guard resolution is now a state machine!
resolving <--> (error | redirect | render)
- new guard function signature
guard(context, next)
, where context contains the route to, from, meta, and an AbortSignal for cancelling fetches - returning
next
is now a requirement for guard functions - loading + error pages now correctly use overrides
- all use of the internal
__RouterContext
has been removed—data returned from guards is now accessible via theuseGuardData
hook
What this does
Describe what changes were made in more detail
How to test
Describe how to test your changes
TODO
- [ ] update documentation
- [ ] tests tests tests!
- [x] remove use of internal
RouterContext
in favor ofuseGuardData
?
Any updates on the new version ?
@joshpensky Are you planning release this anytime soon?