I'm a Ruby on Rails and React Native enthusiast with over four years of experience creating innovative software solutions. I work well in teams and am always up for challenging projects. I enjoy playing chess and gaming in my free time.
1 minute read
SyntheticEvent in React is a cross-browser wrapper similar to browers’s native events;
It has the same interface as the browser’s native event,
including stopPropagation() and preventDefault(),
except the events work identically across all browsers.
Until React 18,
React’s synthetic media events contain several existing media events,
for instance onLoadedMetadata and onVolumeChange.
But there is no onResize handler.
<video> element with a onResize prop would display a warning
Warning: Unknown event handler property `onResize`. It will be ignored.
With the changes
in React 18,
onResize props are added to <video> element that triggers when one or both of the videoWidth and videoHeight attributes have just been updated.
It’s useful for responding to resolution changes in video players.