When to use touchmove vs mousemove?
you can use both in one component (w.r.t react)
for eg:
<component onMouseMove={handleMouseMove} onTouchMove={handleMouseMove} />
on the bases of screen which is being used react will automatically switch either option of mouse or touch
or you can also use
("ontouchstart" in document.documentElement)
it gives true for touch screen device and vice versa
ref: https://codepen.io/tteske/pen/KKwxOxp
Except on the ipad -- where mouse hover, mouse down, mouse up and click are all triggered... except if you change anything in mouse hover .. then nothing else gets triggered.... very annoying...more details see http://sitr.us/2011/07/28/how-mobile-safari-emulates-mouse-events.html
For parity between desktop and touch you have the following equivalences:
mousedown === touchstart
mousemove === touchmove
mouseup === touchend
Thus if you handle mousedown
, mousemove
and mouseup
then you don't need to handle the corresponding equivalent events under touch. The same handlers should be executing.