Skip to content

Conversation

@aionda
Copy link

@aionda aionda commented Apr 11, 2017

Specified which onClick is being referred to. The onClick in Square's render has to be named onClick.

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact [email protected] if you have any questions.

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

```

This means that when the square is clicked, it calls the onClick function that was passed by the parent. The `onClick` doesn't have any special meaning here, but it's popular to name handler props starting with `on` and their implementations with `handle`. Try clicking a square – you should get an error because we haven't defined `handleClick` yet. Add it to the Board class:
This means that when the square is clicked, it calls the onClick function that was passed by the parent. The `onClick` in `renderSquare doesn't have any special meaning here, but it's popular to name handler props starting with `on` and their implementations with `handle`. Try clicking a square – you should get an error because we haven't defined `handleClick` yet. Add it to the Board class:

Choose a reason for hiding this comment

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

The `onClick` in `renderSquare doesn't have any special meaning here,

is missing ending tick after renderSquare

The `onClick` in `renderSquare` doesn't have any special meaning here,

Copy link
Author

Choose a reason for hiding this comment

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

@bondarewicz Thanks, fixed!

```

This means that when the square is clicked, it calls the onClick function that was passed by the parent. The `onClick` doesn't have any special meaning here, but it's popular to name handler props starting with `on` and their implementations with `handle`. Try clicking a square – you should get an error because we haven't defined `handleClick` yet. Add it to the Board class:
This means that when the square is clicked, it calls the onClick function that was passed by the parent. The `onClick` in `renderSquare` doesn't have any special meaning here, but it's popular to name handler props starting with `on` and their implementations with `handle`. Try clicking a square – you should get an error because we haven't defined `handleClick` yet. Add it to the Board class:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we just move this section about "no special meaning" above to where it's defined, and add a sentence here that this is where onClick has special meaning (because it's on an a built-in component like <button> rather than our custom Square).

@gaearon
Copy link
Collaborator

gaearon commented Apr 18, 2017

Thanks for PR. We went with another solution in #9427 so closing this one.

@gaearon gaearon closed this Apr 18, 2017
@gaearon
Copy link
Collaborator

gaearon commented May 1, 2017

@brigand and I rewrote some parts of the tutorial in #9454, and following along should be easier now. Let us know if you're still struggling! We’re happy to look at remaining issues in case we missed anything.

https://facebook.github.io/react/tutorial/tutorial.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants