Skip to content

Commit 3481b5b

Browse files
eps1lonferdaber
andauthored
Update README.md
Co-Authored-By: ferdaber <[email protected]>
1 parent 3f875c0 commit 3481b5b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ When using `useEffect`, take care not to return anything other than a function o
232232
```ts
233233
function DelayedEffect(props: { timerMs: number }) {
234234
// bad! setTimeout implicitly returns a number because the arrow function body isn't wrapped in curly braces
235-
useEffect(() => setTimeout(() => {/* do stuff */}, props.timerMs), [timerMs])
235+
const { timerMs } = props;
236+
useEffect(() => setTimeout(() => {/* do stuff */}, timerMs), [timerMs])
236237
return null
237238
}
238239
```

0 commit comments

Comments
 (0)