Skip to content

updated tutorial.md #2940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions content/tutorial/tutorial.md
Original file line number Diff line number Diff line change
@@ -845,18 +845,6 @@ The Board component now looks like this:

```javascript{17,18}
class Board extends React.Component {
handleClick(i) {
Copy link
Collaborator

@alexkrolick alexkrolick Apr 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this replace "this.props.onClick" in renderSquare?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.props.onClick can either be inside the handleClick method, or the handleClick method should also be deleted from the Board component since it isn't being called anywhere at that point so learners(like me) can follow along properly.

const squares = this.state.squares.slice();
if (calculateWinner(squares) || squares[i]) {
return;
}
squares[i] = this.state.xIsNext ? 'X' : 'O';
this.setState({
squares: squares,
xIsNext: !this.state.xIsNext,
});
}

renderSquare(i) {
return (
<Square