What is the TypeScript definition for the onScrollCapture event in React?
The right interface for onScrollCapture is UIEvent
Please continue reading below to see how to use it or read my guide on using React events with TypeScript.
You can also go to the search page 🔍 to find another event.
Interface
interface UIEvent<T = Element, E = NativeUIEvent> extends SyntheticEvent<T, E> {
detail: number;
view: AbstractView;
}
Full example
import React, { UIEvent } from 'react';
const App = () => {
const handleUIEvent = (e: UIEvent<HTMLDivElement>) => {
// Do something
};
return <div onScrollCapture={handleUIEvent}>{/** Some code */}</div>;
};
export default App;