Skip to content

Commit 02c0067

Browse files
remove Bad grammar in react.dev tictactoe documentation (#6126)
* change docs * add docs for create react app * remove * Update src/content/learn/tutorial-tic-tac-toe.md --------- Co-authored-by: Ricky <[email protected]>
1 parent 22d9878 commit 02c0067

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/content/learn/tutorial-tic-tac-toe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ Why didn't this problem happen earlier?
11731173
11741174
When you were passing `onSquareClick={handleClick}`, you were passing the `handleClick` function down as a prop. You were not calling it! But now you are *calling* that function right away--notice the parentheses in `handleClick(0)`--and that's why it runs too early. You don't *want* to call `handleClick` until the user clicks!
11751175
1176-
You could fix by creating a function like `handleFirstSquareClick` that calls `handleClick(0)`, a function like `handleSecondSquareClick` that calls `handleClick(1)`, and so on. You would pass (rather than call) these functions down as props like `onSquareClick={handleFirstSquareClick}`. This would solve the infinite loop.
1176+
You could fix this by creating a function like `handleFirstSquareClick` that calls `handleClick(0)`, a function like `handleSecondSquareClick` that calls `handleClick(1)`, and so on. You would pass (rather than call) these functions down as props like `onSquareClick={handleFirstSquareClick}`. This would solve the infinite loop.
11771177
11781178
However, defining nine different functions and giving each of them a name is too verbose. Instead, let's do this:
11791179

0 commit comments

Comments
 (0)