remove duplicate blog in the router example

This commit is contained in:
Evan Almloff 2024-01-16 15:54:09 -06:00
parent ad01a45f3b
commit 341bc7f6a1
2 changed files with 5 additions and 3 deletions

View file

@ -5,7 +5,7 @@ fn main() {
launch_desktop(Route::Home {});
}
#[derive(Routable, Clone)]
#[derive(Routable, Clone, Debug, PartialEq)]
#[rustfmt::skip]
enum Route {
#[layout(NavBar)]
@ -15,7 +15,7 @@ enum Route {
#[layout(Blog)]
#[route("/")]
BlogList {},
#[route("/blog/:name")]
#[route("/:name")]
BlogPost { name: String },
#[end_layout]
#[end_nest]
@ -49,11 +49,13 @@ fn NavBar() -> Element {
#[component]
fn Home() -> Element {
println!("Home");
rsx! { h1 { "Welcome to the Dioxus Blog!" } }
}
#[component]
fn Blog() -> Element {
println!("Blog");
rsx! {
h1 { "Blog" }
Outlet::<Route> {}

View file

@ -1,4 +1,4 @@
use dioxus_lib::prelude::{consume_context, try_consume_context, use_hook};
use dioxus_lib::prelude::{try_consume_context, use_hook};
use crate::prelude::{Navigator, RouterContext};