VOOZH about

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

⇱ React onPointerMove Event - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

React onPointerMove Event

Last Updated : 24 Jul, 2024

The onPointerMove event in React fires whenever the cursor moves inside the tag or element where the event has been applied. Similar to other events, the onPointerMove takes a function which defines the process/task which has to be applied.

Syntax:

onPointerMove={function}

Parameter :

  • function: The function which has to be called when the mouse is moving (hovering) over the specified element.

Return type:

  • event: 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 that will fire the event, and the function passed to the event will give an alert that the pointer is moving.

Output:

Example 2: In this example, we implemented an area where users can move their cursor. When this occurs, an event will fire and "Pointer is moving" will be printed in the console.

Output:

Comment
Article Tags: