Crates.io | yew-nested-router |
lib.rs | yew-nested-router |
version | 0.7.2 |
source | src |
created_at | 2022-12-05 12:05:04.671826 |
updated_at | 2024-09-19 11:33:16.37583 |
description | A router for Yew which supports nesting |
homepage | |
repository | https://github.com/ctron/yew-nested-router |
max_upload_size | |
id | 730257 |
size | 58,550 |
A router for Yew that supports nesting.
In a nutshell, you define a main router entry point (<Router<T>>
) where you can switch the rendering (<Switch<T>>
).
You can then translate down to the next layer (Scope<P, C>
), so that you can switcher rendering again (Switch<C>
).
See a complete example: examples/yew-nested-router-example, which you can run using:
trunk serve examples/yew-nested-router-example/index.html
This project was born out of the need for a nesting router using Yew. This used to work in past releases, but starting with 0.19, the router implementation was swapped out for a new one which didn't properly support nesting. It still was possible to backport the old router to Yew 0.19, using the Yew Agent project.
However, in Yew Agent 0.2, which is required by Yew 0.20, the "context" agent was removed. So it was no longer possible to backport the old router implementation.
This is a new, from scratch, implementation of a router for Yew. It supports nesting, and using Rust types for routes.
This is not a drop-in replacement for the old Yew router. This section briefly describes which choices this implementation made:
/
) into segments.