-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6a3e38
commit d109b2f
Showing
7 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#![allow(non_snake_case)] | ||
use dioxus::prelude::*; | ||
use dioxus_router::prelude::*; | ||
|
||
#[derive(Routable, Clone)] | ||
enum Route { | ||
#[route("/")] | ||
Home {}, | ||
} | ||
|
||
// ANCHOR: app | ||
#[component] | ||
fn App() -> Element { | ||
rsx! {Router::<Route> { config: || RouterConfig::default().history(WebHistory::default()) }} | ||
} | ||
// ANCHOR_END: app | ||
|
||
#[component] | ||
fn Home() -> Element { | ||
rsx! { h1 { "Welcome to the Dioxus Blog!" } } | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// ANCHOR: router | ||
#![allow(non_snake_case)] | ||
use dioxus::prelude::*; | ||
use dioxus_router::prelude::*; | ||
|
||
/// An enum of all of the possible routes in the app. | ||
#[derive(Routable, Clone)] | ||
enum Route { | ||
// The home page is at the / route | ||
#[route("/")] | ||
Home {}, | ||
} | ||
// ANCHOR_END: router | ||
|
||
// ANCHOR: app | ||
#[component] | ||
fn App() -> Element { | ||
rsx! {Router::<Route> { config: || RouterConfig::default().history(WebHistory::default()) }} | ||
} | ||
// ANCHOR_END: app | ||
|
||
// ANCHOR: home | ||
#[component] | ||
fn Home() -> Element { | ||
rsx! { h1 { "Welcome to the Dioxus Blog!" } } | ||
} | ||
// ANCHOR_END: home | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters