This is unreleased documentation for Yew Next version.
For up-to-date documentation, see the latest version on

Function yew::suspense::use_future_with

source ·
pub fn use_future_with<'hook, F, D, T, O>(
    deps: D,
    f: F
) -> impl 'hook + Hook<Output = SuspensionResult<UseFutureHandle<O>>>
where F: FnOnce(Rc<D>) -> T + 'hook, T: Future<Output = O> + 'static + 'hook, O: 'static + 'hook, D: PartialEq + 'static + 'hook,
Expand description

Use the result of an async computation with dependencies, suspending while waiting.

Awaits the future returned from f for the latest deps. Even if the future is immediately ready, the hook suspends at least once. If the dependencies change while a future is still pending, the result is never used. This guarantees that your component always sees up-to-date values while it is not suspended.


When used in function components and hooks, this hook is equivalent to:

pub fn use_future_with<F, D, T, O>(deps: D, f: F) -> SuspensionResult<UseFutureHandle<O>>
    F: FnOnce(Rc<D>) -> T,
    T: Future<Output = O> + 'static,
    O: 'static,
    D: PartialEq + 'static,
    /* implementation omitted */