Skip to content

Commit 95ca895

Browse files
authored
Update part-1d, missing syntax
The 3 Button components in the example were directly calling the setToValue() function instead of wrapping it into a function and then calling it (just like in the screenshot below). When copy and pasted into vscode, React would error out due to an infinite loop. This fix matches the correct way like in the screenshot.
1 parent c563014 commit 95ca895

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/content/1/en/part1d.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -935,9 +935,9 @@ const App = (props) => {
935935
return (
936936
<div>
937937
{value}
938-
<Button handleClick={setToValue(1000)} text="thousand" /> // highlight-line
939-
<Button handleClick={setToValue(0)} text="reset" /> // highlight-line
940-
<Button handleClick={setToValue(value + 1)} text="increment" /> // highlight-line
938+
<Button handleClick={() => setToValue(1000)} text="thousand" /> // highlight-line
939+
<Button handleClick={() => setToValue(0)} text="reset" /> // highlight-line
940+
<Button handleClick={() => setToValue(value + 1)} text="increment" /> // highlight-line
941941
</div>
942942
)
943943
}

0 commit comments

Comments
 (0)