[][src]Macro yew_router::define_router_state

macro_rules! define_router_state {
    ($StateT:ty) => { ... };
    ($StateT:ty, $StateName:expr) => { ... };
}

Generates a module named router_state containing aliases to common structures within yew_router that deal with operating with Route and its state values as well as functions for rendering routes.

Because they should be the same across a given application, its a handy way to make sure that every type that could be needed is generated.

This macro is used to generate aliases for the state type of () within yew_router. Instead of doing these yourself, use this macro if you need to store state in the browser.

Example

define_router_state!(Option<String>);
use router_state::Route; // alias to Route<Option<String>>