Skip to content

Commit

Permalink
Simple NodeRef passing to <Link> for yew-router (#2877)
Browse files Browse the repository at this point in the history
* simple NodeRef passing

* using `anchor_ref` opposed to `a_ref` per @futursolo's review
  • Loading branch information
athanclark committed Sep 19, 2022
1 parent ce70e4c commit 89dd3b3
Showing 1 changed file with 5 additions and 0 deletions.
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

0 comments on commit 89dd3b3

Please sign in to comment.