Macro is_ssr
macro_rules! is_ssr { () => { ... }; ($($tt:tt)*) => { ... }; }
Expand description
A macro that expands to whether we are in SSR mode or not.
Can also be used with a block to only include the code inside the block if in SSR mode.
ยงExample
if is_ssr!() {
println!("We are running on the server!");
}
is_ssr! {
// Access server only APIs in here.
let _ = access_database();
}