diff --git a/packages/web-haptics/src/react/useWebHaptics.ts b/packages/web-haptics/src/react/useWebHaptics.ts index ac0ce42..388d05e 100644 --- a/packages/web-haptics/src/react/useWebHaptics.ts +++ b/packages/web-haptics/src/react/useWebHaptics.ts @@ -11,8 +11,11 @@ import type { export function useWebHaptics(options?: WebHapticsOptions) { const instanceRef = useRef(null); - useEffect(() => { + if (instanceRef.current === null) { instanceRef.current = new WebHaptics(options); + } + + useEffect(() => { return () => { instanceRef.current?.destroy(); instanceRef.current = null;