sycamore::prelude

Macro is_not_ssr

macro_rules! is_not_ssr {
    () => { ... };
    ($($tt:tt)*) => { ... };
}
Expand description

A macro that expands to whether we are in DOM mode or not.

Can also be used with a block to only include the code inside the block if in DOM mode.

ยงExample

if is_not_ssr!() {
    console_log!("We are running in the browser!");
}

is_not_ssr! {
    // Access browser only APIs in here.
    let document = document();
}