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

The right interface for onPointerMoveCapture is PointerEvent

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 PointerEvent<T = Element> extends MouseEvent<T, NativePointerEvent> {
    pointerId: number;
    pressure: number;
    tangentialPressure: number;
    tiltX: number;
    tiltY: number;
    twist: number;
    width: number;
    height: number;
    pointerType: 'mouse' | 'pen' | 'touch';
    isPrimary: boolean;
}

Full example

import React, { PointerEvent } from 'react';

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

  return <div onPointerMoveCapture={handlePointerEvent}>{/** Some code */}</div>;
};

export default App;

Attributes that use PointerEvent:

Get notified about new tutorials

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

No spam. Unsubscribe at any time.