mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 12:43:08 +00:00
fix: interpreter namespace
This commit is contained in:
parent
642b21f125
commit
cd93e469e2
1 changed files with 8 additions and 7 deletions
|
@ -20,7 +20,6 @@ struct ListBreeds {
|
||||||
|
|
||||||
async fn app_root(cx: Scope<'_>) -> Element {
|
async fn app_root(cx: Scope<'_>) -> Element {
|
||||||
let breed = use_state(&cx, || "deerhound".to_string());
|
let breed = use_state(&cx, || "deerhound".to_string());
|
||||||
|
|
||||||
let breeds = use_future(&cx, (), |_| async move {
|
let breeds = use_future(&cx, (), |_| async move {
|
||||||
reqwest::get("https://dog.ceo/api/breeds/list/all")
|
reqwest::get("https://dog.ceo/api/breeds/list/all")
|
||||||
.await
|
.await
|
||||||
|
@ -35,14 +34,16 @@ async fn app_root(cx: Scope<'_>) -> Element {
|
||||||
h1 { "Select a dog breed!" }
|
h1 { "Select a dog breed!" }
|
||||||
div { display: "flex",
|
div { display: "flex",
|
||||||
ul { flex: "50%",
|
ul { flex: "50%",
|
||||||
breeds.message.keys().take(5).map(|cur_breed| rsx!(
|
for cur_breed in breeds.message.keys().take(10) {
|
||||||
li {
|
rsx! {
|
||||||
button {
|
li { key: "{cur_breed}",
|
||||||
onclick: move |_| breed.set(cur_breed.clone()),
|
button {
|
||||||
"{cur_breed}"
|
onclick: move |_| breed.set(cur_breed.clone()),
|
||||||
|
"{cur_breed}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
))
|
}
|
||||||
}
|
}
|
||||||
div { flex: "50%", Breed { breed: breed.to_string() } }
|
div { flex: "50%", Breed { breed: breed.to_string() } }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue