yewstack/yew_router

RouterLink to support child components

jetli opened this issue · 2 comments

jetli commented

Description
Can we add child components support to RouterLink ? Now we can only use simple text property to set children of RouterLink, e.g.

<RouterLink ...>
    <i class="ion-edit"></i> { "Edit Article" }
</RouterLink >

a senario: https://github.com/jetli/rust-yew-realworld-example-app/blob/a99af18ec64ef74d6c3ac97419fc7de47eaa892d/crates/conduit-wasm/src/components/article/article_actions.rs#L79 , similar to button bellow.

Yes. This wasn't really practical until very recently with the removal of the type parameter from Html in the Yew crate.

Now that that is gone, its very simple to just replace the text: String field with a children: Children one.

As part of this change. I think RouterLink should be renamed to RouterAnchor in order to not have similar naming to ComponentLink and AgentLink which have behaviors very different from RouterLink.