Skip to content

Commit

Permalink
chore: Minor fixes for the examples
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Jun 22, 2024
1 parent 0f630c3 commit a875926
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ async fn fetch_user(keys: Vec<QueryKey>) -> QueryResult<QueryValue, QueryError>
}

#[allow(non_snake_case)]
#[inline_props]
#[component]
fn User(id: usize) -> Element {
let value = use_get_query([QueryKey::User(id)], fetch_user);

render!( p { "{value.result().value():?}" } )
rsx!( p { "{value.result().value():?}" } )
}

fn app() -> Element {
Expand All @@ -76,7 +76,7 @@ fn app() -> Element {
client.invalidate_query(QueryKey::User(0));
};

render!(
rsx!(
User { id: 0 }
button { onclick, label { "Refresh" } }
)
Expand Down
8 changes: 3 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,19 @@
//! }
//!
//! #[allow(non_snake_case)]
//! #[inline_props]
//! #[component]
//! fn User(id: usize) -> Element {
//! let value = use_get_query(QueryKey::User(id)], fetch_user);
//!
//! render!( p { "{value.result().value():?}" } )
//! rsx!( p { "{value.result().value():?}" } )
//! }
//!
//!
//! fn app() -> Element {
//! let client = use_query_client::<QueryValue, QueryError, QueryKey>();
//!
//! let onclick = move |_| {
//! spawn(async move {
//! client.invalidate_query(QueryKey::User(0)).await;
//! });
//! client.invalidate_query(QueryKey::User(0));
//! };
//!
//! rsx!(
Expand Down

0 comments on commit a875926

Please sign in to comment.