Macro sauron::prelude::key

source ·
macro_rules! key {
    ( $($arg: tt)* ) => { ... };
}
Expand description

creates a key attribute using a formatter

§Examples

use sauron::{*, html::{*, attributes::*}};

let number = 42;
let button:Node<()> = button([key!("content-{}", 42)], [text("Click")]);

assert_eq!(node!{<button key=format!("content-42")>"Click"</button>}, button);