Function dioxus_query::use_query

source ·
pub fn use_query<T, E, K>(
    cx: &ScopeState,
    query_keys: impl FnOnce() -> Vec<K>,
    query_fn: impl Fn(&[K]) -> BoxFuture<'_, QueryResult<T, E>> + 'static + Send + Sync
) -> &UseValue<T, E, K>where
    T: 'static + PartialEq + Clone,
    E: 'static + PartialEq + Clone,
    K: Clone + Eq + Hash + 'static,
Expand description

Register a query listener with the given combination of query keys and query function.

Example:

let users_query = use_query(cx, move || vec![QueryKeys::User(id)], fetch_user);