From 167b030818ba21001ff30dc99d0bea596b03c8be Mon Sep 17 00:00:00 2001 From: zqran Date: Mon, 5 Sep 2022 21:19:24 +0800 Subject: [PATCH] [Beta] update `handleClick()` to `handleClick` (#4984) --- beta/src/pages/learn/state-a-components-memory.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beta/src/pages/learn/state-a-components-memory.md b/beta/src/pages/learn/state-a-components-memory.md index 949f83ce..a8a9b208 100644 --- a/beta/src/pages/learn/state-a-components-memory.md +++ b/beta/src/pages/learn/state-a-components-memory.md @@ -151,7 +151,7 @@ button { -The `handleClick()` event handler is updating a local variable, `index`. But two things prevent that change from being visible: +The `handleClick` event handler is updating a local variable, `index`. But two things prevent that change from being visible: 1. **Local variables don't persist between renders.** When React renders this component a second time, it renders it from scratch—it doesn't consider any changes to the local variables. 2. **Changes to local variables won't trigger renders.** React doesn't realize it needs to render the component again with the new data. @@ -190,7 +190,7 @@ const [index, setIndex] = useState(0); > The `[` and `]` syntax here is called [array destructuring](/learn/a-javascript-refresher#array-destructuring) and it lets you read values from an array. The array returned by `useState` always has exactly two items. -This is how they work together in `handleClick()`: +This is how they work together in `handleClick`: ```js function handleClick() {