Function leptos::create_resource_with_initial_value
source · pub fn create_resource_with_initial_value<S, T, Fu>(
cx: Scope,
source: impl Fn() -> S + 'static,
fetcher: impl Fn(S) -> Fu + 'static,
initial_value: Option<T>
) -> Resource<S, T>where
S: PartialEq<S> + Debug + Clone + 'static,
T: Serializable + 'static,
Fu: Future<Output = T> + 'static,
Expand description
Creates a Resource with the given initial value, which
will only generate and run a Future using the fetcher
when the source
changes.
When server-side rendering is used, the server will handle running the Future and will stream the result to the client. This process requires the output type of the Future to be Serializable. If your output cannot be serialized, or you just want to make sure the Future runs locally, use create_local_resource_with_initial_value().