[Typo]: using function before creating it in example
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.8k
- Forks
- 7.9k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 11
Description
Summary
The code example on "How does React know which state to return?" Deep Dive section in the "State: A Component's Memory" page is using the setState function before defining it. While this code would work due to function hoisting in javascript, it's generally is not recommended, especially as it disturbs the reading flow for code snippets.
Page
https://react.dev/learn/state-a-components-memory#how-does-react-know-which-state-to-return
Details
No response
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
Open the linked “State: A Component's Memory” page at the “How does React know which state to return?” Deep Dive section and inspect its code example. Reorder the example so setState is defined before it is used, then verify that the snippet remains correct and reads in the intended order.
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
- Clearly specified
- Newbie friendliness
- 65/100