Macro vertigo::bind

source ·
bind!() { /* proc-macro */ }
Expand description

Allows to create an event handler based on provided arguments

use vertigo::{bind, dom, Value};

let count = Value::new(0);

let increment = bind!(count, || {
    count.change(|value| {
        *value += 1;
    });
});

dom! {
    <div>
        <p>"Counter: " { count }</p>
        <button on_click={increment}>"+"</button>
    </div>
};