Misleading note in the tutorial
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.8k
- Forks
- 7.9k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 11
Description
This note from the tutorial: reactjs.org/tutorial/tutorial.html#functional-components
Note
When we modified the Square to be a functional component, we also changedonClick={() => this.props.onClick()}to a shorteronClick={props.onClick}(note the lack of parentheses on both sides). In a class, we used an arrow function to access the correctthisvalue, but in a functional component we don’t need to worry aboutthis.
The note seems to suggest that onClick={this.props.onClick} wouldn't work in a class component, but that's false.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the functional-components section at reactjs.org/tutorial/tutorial.html#functional-components and review the quoted note alongside the class-component example. Revise the note so it does not imply that onClick={this.props.onClick} cannot work in a class component; done means the explanation is accurate and still clearly describes the shorter functional-component form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100