瀏覽代碼

Merge pull request #178 from autarch/autarch/spelling-fix

Fix misspelled variable name in usestate.rs
Jonathan Kelley 3 年之前
父節點
當前提交
13cf95a9ea
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 1 1
      packages/hooks/src/use_shared_state.rs
  2. 2 2
      packages/hooks/src/usestate.rs

+ 1 - 1
packages/hooks/src/use_shared_state.rs

@@ -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
packages/hooks/src/usestate.rs

@@ -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);
     }