Skip to content

Commit 2b22bcd

Browse files
Pascal-SoMadoshakalaka
authored andcommitted
update use_reducer docs
1 parent 3b06943 commit 2b22bcd

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

packages/yew/src/functional/hooks/use_reducer.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,13 @@ where
330330
/// implement a `Reducible` trait which defines the associated `Action` type and a
331331
/// reducer function.
332332
///
333-
/// This hook will always trigger a re-render upon receiving an action. See
334-
/// [`use_reducer_eq`] if you want the component to only re-render when the state changes.
333+
/// This hook will trigger a re-render whenever the reducer function produces a new `Rc` value upon
334+
/// receiving an action. If the reducer function simply returns the original `Rc` then the component
335+
/// will not re-render. See [`use_reducer_eq`] if you want the component to first compare the old and
336+
/// new state and only re-render when the state actually changes.
337+
///
338+
/// To cause a re-render even if the reducer function returns the same `Rc`, take a look at
339+
/// [`use_force_update`].
335340
///
336341
/// # Example
337342
/// ```rust

0 commit comments

Comments
 (0)