ArcGIS JavaScript API 4 – Hover Feature Event

The way hover events work in the JavaScript API 4 vs 3 is a bit different. In the 3.x API, you could use the “mouse-move”, “mouse-over”, and “mouse-out” events on the Feature Layer object itself. See example here:

But in the 4.x API, you want to use the “pointer-move” event of the MapView (or SceneView). But that will give you events on any time the pointer moves in the map. So you then have to run a “hit-test” on the result to see what feature it is hovering over (if any). Example here: