Macro dominator::link

source ·
macro_rules! link {
    ($url:expr, { $($methods:tt)* }) => { ... };
}
Expand description

Creates an <a> element which works with routing.

Normally when the user clicks on an <a> element the browser will handle the URL routing.

But if you are creating a Single Page Application (SPA) then you want your app to always be in control of routing.

The link! macro creates an <a> element which disables browser routing, so your app remains in control of routing:

link!("/my-url/foo", {
    .class(...)
    .style(...)
})

Also see the on_click_go_to_url! macro.