Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: <Redirect /> and hooks for yew-router #2113

Closed
futursolo opened this issue Oct 14, 2021 · 0 comments · Fixed by #2118
Closed

Proposal: <Redirect /> and hooks for yew-router #2113

futursolo opened this issue Oct 14, 2021 · 0 comments · Fixed by #2118
Labels
A-yew-router Area: The yew-router crate

Comments

@futursolo
Copy link
Member

futursolo commented Oct 14, 2021

This is created as an issue as per suggestion by @mc1098 in #2107.
Feel free to move this to discussion if not appropriate.

This issue proposes the following changes to yew-router:

  • Add a <Redirect<R> to={route} /> component to yew-router that mirrors react-router's <Redirect /> component.
  • Rename prop route to to for <Link /> so it is consistent with <Redirect />.
  • Make <Router /> a context provider
  • Add Location and History that mirrors the behaviour of history package on npm.
  • Introduce use_history, use_location and use_route hook.
  • Introduce a RouterScopeExt that provides history location and route methods on ctx.link().

I have a custom fork that have some of the changes implemented but that branch also contains changes proposed in #2107.
I will file a PR for this issue after #2107 is settled.

@mc1098 mc1098 added the A-yew-router Area: The yew-router crate label Oct 14, 2021
voidpumpkin pushed a commit that referenced this issue Nov 11, 2021
* Add Redirect Comp.

* Fix router behaviour.

* Fix output.

* Fix pr-flow.

* Remove Redirect.

* Readd 77b46bf.

* Router Context, History and Location.

* Finish Porting.

* Add Switch, Fix example.

* Add state.

* Fix pr-flow.

* Fix pr-flow.

* Fix unstable feature for 1.49.

* Add documentation.

* Error Types & Simplify Implementation.

* Add some tests.

* Update documentation.

* Fix route outside of a Switch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-yew-router Area: The yew-router crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants