Merge branch 'master' into jk/debugging-diff

This commit is contained in:
Jonathan Kelley committed 2022-01-31 02:51:59 -05:00
commit 236ef9a8c4
8 files changed
+255 -5

No files matched your search

+1 -1
View File
@@ -33,7 +33,7 @@ impl<T> ProvidedStateInner<T> {
/// This hook provides some relatively light ergonomics around shared state.
///
/// It is not a substitute for a proper state management system, but it is capable enough to provide use_state - type
/// ergonimics in a pinch, with zero cost.
/// ergonomics in a pinch, with zero cost.
///
/// # Example
///
+2 -2
View File
@@ -153,8 +153,8 @@ impl<T: 'static> UseState<T> {
/// }
/// ```
pub fn modify(&self, f: impl FnOnce(&T) -> T) {
let curernt = self.slot.borrow();
let new_val = f(curernt.as_ref());
let current = self.slot.borrow();
let new_val = f(current.as_ref());
(self.setter)(new_val);
}