Add explanation on React event systems in documentation
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.8k
- Forks
- 7.9k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 11
Description
Recently I come across a task to embed a React app into another project. It takes a torturing amount of time to learn the lesson that React events and native events are different in significant ways. This article greatly elaborates on it: https://fortes.com/2018/react-and-dom-events/
I didn't see any related details in event-related documentations in React though. It would save a lot of time for future readers if the documentation could contain the analysis and explanation of these points:
Avoid using addEventListener and rely on React event handlers
Listen on document (or window) if you want to receive events after all React handlers. Listen anywhere else in order to receive before React handlers
React event handlers will always execute after native capture handlers
Thanks.
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
Review the existing event-related React documentation and the linked React-and-DOM events article. Add an explanation covering React handlers versus addEventListener, listener ordering on document or window, and native capture handlers; the documentation should let readers understand when each event system runs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- documentation, frontend
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100