fix: interpreter namespace

This commit is contained in:
Jonathan Kelley 2022-11-16 22:10:04 -08:00
parent 642b21f125
commit cd93e469e2

View file

@ -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! {
li { key: "{cur_breed}",
button { button {
onclick: move |_| breed.set(cur_breed.clone()), onclick: move |_| breed.set(cur_breed.clone()),
"{cur_breed}" "{cur_breed}"
} }
} }
)) }
}
} }
div { flex: "50%", Breed { breed: breed.to_string() } } div { flex: "50%", Breed { breed: breed.to_string() } }
} }