Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
ranile committed May 17, 2021
1 parent 031ab20 commit 8827def
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/concepts/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fn app() -> Html {
}
}

fn switch(routes: Routes) -> Html {
fn switch(routes: &Routes) -> Html {
match route {
Route::Home => html! { <h1>{ "Home" }</h1> },
Route::Secure => {
Expand Down
6 changes: 3 additions & 3 deletions examples/router/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@ impl Model {
}
}

fn switch(routes: Route) -> Html {
fn switch(routes: &Route) -> Html {
match routes {
Route::Post { id } => {
html! { <Post seed=id /> }
html! { <Post seed=*id /> }
}
Route::Posts => {
html! { <PostList /> }
}
Route::Author { id } => {
html! { <Author seed=id /> }
html! { <Author seed=*id /> }
}
Route::Authors => {
html! { <AuthorList /> }
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ enum Route {
NotFound,
}

fn switch(routes: Route) -> Html {
fn switch(routes: &Route) -> Html {
let onclick_callback = Callback::from(|_| yew_router::service::push(Route::Home, None));
match routes {
Route::Home => html! { <h1>{ "Home" }</h1> },
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//! }
//! # }
//!
//! fn switch(routes: Route) -> Html {
//! fn switch(routes: &Route) -> Html {
//! let onclick_callback = Callback::from(|_| yew_router::push_route(Route::Home));
//! match routes {
//! Route::Home => html! { <h1>{ "Home" }</h1> },
Expand Down

0 comments on commit 8827def

Please sign in to comment.