Return to site
· Bubbling,Capturing,Web Development,web applications,React js
broken image

Both bubbling and capturing are supported by React. The event handlers are triggered by the bubbling phase. Attach a handler to an eventual parent of an element then any event that is triggered on that element will bubble to the parent until it is stopped by stopPropagation. You have to append Capture to the event name to register an event handler for capture phase. Example: You will use onClickCaputure to handle the click event in the event phase instead of using onClick.

Example for Bubbling:

Click me, and my parent's `onClick` will fire!

Example of Capturing:

Click me, and my parent's `onClickCapture` will fire *first*!