mouse event in javascript code example

Example 1: detect mouse javascript

/* npm i tappify */
import Tappify from "tappify";

/* Only works in react.js */
function myComponent() {
  return <>
    <Tappify.Finger>
      Client is using finger *tap tap*
    </Tappify.Finger>
 
    <Tappify.Cursor>
      Client is using mouse cursor *click click*
    </Tappify.Cursor>
  </>
}
//more info: https://github.com/asplunds/tappify

Example 2: javascript mouse events

element.addEventListener("mousemove", function(event) {
  console.log(event);
}); //Calls function every time the mouse moves over 'element'