[Suggestion]: Make clear why Ref was used in the third solution
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 solution for the third challenge, "Fix debouncing," does not require a Ref. Moving the let timeoutID; to the top inside the DebouncedButton component will fix the debouncing. Either point this out in the explanation or make it re-render so the solution requires Ref.
Page
https://react.dev/learn/referencing-values-with-refs
Details
Since code example does not use State, there's no re-rendering, and so there's no need to use Ref to remember anything across re-renders. The page mentions that Refs are not used often; although future-proof, I think the example should only use Ref when necessary.
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 at the “Referencing Values with Refs” page and inspect the third challenge, “Fix debouncing,” including its explanation and solution. Done means the documentation explains why Ref is used, or the example is changed so re-rendering makes Ref necessary; verify the rendered page and challenge wording.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100