react-router-guards
react-router-guards copied to clipboard
V2 Internals Rewrite
trafficstars
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
nextis now a requirement for guard functions - loading + error pages now correctly use overrides
- all use of the internal
__RouterContexthas been removed—data returned from guards is now accessible via theuseGuardDatahook
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
RouterContextin favor ofuseGuardData?
Any updates on the new version ?
@joshpensky Are you planning release this anytime soon?