I was wondering what is the difference between react events: onFocus
and onFocusCapture
. I could not find an appropriate answer on react's documentation page.
<OutlinedInput
label="price from"
onFocus={handlePriceFocus}
/>
<OutlinedInput
label="price to"
onFocusCapture={handlePriceFocus}
/>
In my case, it seems like onFocus
and onFocusCapture
do the same functionality because I have not noticed any difference when using those two events.
This is what React say in their documentation:
"The event handlers below are triggered by an event in the bubbling phase. To register an event handler for the capture phase, append Capture to the event name; for example, instead of using onClick, you would use onClickCapture to handle the click event in the capture phase." reactjs.org/docs/events
So, I think there isn't anymore to say about that. What I understand it's like without 'capture' the code is executed after the event and with 'capture' it's executed before.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With