What is the TypeScript definition for the onWheel event in React?

The right interface for onWheel is WheelEvent

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 WheelEvent<T = Element> extends MouseEvent<T, NativeWheelEvent> {
    deltaMode: number;
    deltaX: number;
    deltaY: number;
    deltaZ: number;
}

Full example

import React, { WheelEvent } from 'react';

const App = () => {
  const handleWheelEvent = (e: WheelEvent<HTMLDivElement>) => {
    // Do something
  };

  return <div onWheel={handleWheelEvent}>{/** Some code */}</div>;
};

export default App;

Attributes that use WheelEvent:

Get notified about new tutorials

Join over 1,000 developers who receive React and JavaScript tutorials via email.

No spam. Unsubscribe at any time.