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

The right interface for onPointerUpCapture 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 onPointerUpCapture={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.

© 2022 Felix Gerschau. All rights reserved.