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

Simple NodeRef passing to <Link> for yew-router #2877

Merged
merged 2 commits into from
Sep 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/yew-router/src/components/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ where
pub query: Option<Q>,
#[prop_or_default]
pub disabled: bool,
/// [`NodeRef`](yew::html::NodeRef) for the `<a>` element.
#[prop_or_default]
pub anchor_ref: NodeRef,
#[prop_or_default]
pub children: Children,
}
Expand All @@ -41,6 +44,7 @@ where
children,
disabled,
query,
anchor_ref,
} = props.clone();

let navigator = use_navigator().expect_throw("failed to get navigator");
Expand Down Expand Up @@ -86,6 +90,7 @@ where
{href}
{onclick}
{disabled}
ref={anchor_ref}
>
{ children }
</a>
Expand Down