Skip to content

Add explanation on React event systems in documentation #2536

Description

@moongazers

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions