hoverStore

React UI sensor hook that uses Javascript/Typescript instead of CSS to figure out if the mouse element is in the hover element. So, you can separate the logic from the user interface (UI).

Demo

Hover me

Mouse in the element: false

Usage

<script lang="ts">
import { hoverStore } from "svelte-legos";

let ref: HTMLDivElement | null = null;

$: isHover = hoverStore(ref);

// $isHover will be true/false
// whenever mouse enters/leaves the
// Box
</script>

<Box bind:this={ref}></Box>