VOOZH about

URL: https://www.geeksforgeeks.org/reactjs/react-onpointercancel-event/

⇱ React onPointerCancel Event - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

React onPointerCancel Event

Last Updated : 1 Aug, 2024

React onPointerCancel fires when a pointer event cancels, like when someone is zoomed into an image and the user suddenly leaves it, which is a part of the onPointerCancel event.

Syntax:

onPointerCancel={function}

Parameter :

  • function that will call once any pointer event cancels.

Return type:

  • event: It is an event object containing information about the event like target element and values

Example 1 : In this example, we implemented an area where the user will move their cursor and cancel their pointer inside the area, which will fire a pointer cancellation event that will show an alert.

Output:

Example 2: In this example, we implemented an area where the user will cancel their pointer events, and the message will print on the console..

Output:

Comment
Article Tags: