Skip to content

Commit 212bf06

Browse files
authored
Merge pull request #4234 from sodiel/patch-2
Part 2e: use 'dependency array' instead of 'table'
2 parents 5c6549c + 467f156 commit 212bf06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/2/en/part2e.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ const App = () => {
541541
}
542542
```
543543
544-
The useEffect hook now has _[currency]_ as the second parameter. The effect function is therefore executed after the first render, and <i>always</i> after the table as its second parameter _[currency]_ changes. That is, when the state _currency_ gets a new value, the content of the table changes and the effect function is executed.
544+
The useEffect hook now has _[currency]_ as the second parameter. The effect function is therefore executed after the first render, and <i>always</i> after the dependency array as its second parameter _[currency]_ changes. That is, when the state _currency_ gets a new value, the content of the dependency array changes and the effect function is executed.
545545
546546
It is natural to choose _null_ as the initial value for the variable _currency_, because _currency_ represents a single item. The initial value _null_ indicates that there is nothing in the state yet, and it is also easy to check with a simple if statement whether a value has been assigned to the variable. The effect has the following condition
547547

0 commit comments

Comments
 (0)