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

Function yew::functional::use_reducer_eq

source ·
pub fn use_reducer_eq<'hook, T, F>(
    init_fn: F
) -> impl 'hook + Hook<Output = UseReducerHandle<T>>
where T: Reducible + PartialEq + 'static + 'hook, F: FnOnce() -> T + 'hook,
Expand description

use_reducer but only re-renders when prev_state != next_state.

This requires the state to implement PartialEq in addition to the Reducible trait required by use_reducer.

§Note

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

pub fn use_reducer_eq<T, F>(init_fn: F) -> UseReducerHandle<T>
where
    T: Reducible + PartialEq + 'static,
    F: FnOnce() -> T,
{
    /* implementation omitted */
}