"use client";

import { useEffect } from "react";

export default function CursorEffect() {
  useEffect(() => {
    let cursor: any;
    let isMounted = true;

    import("cursor-effects").then((mod) => {
      if (isMounted && mod?.trailingCursor) {
        const TrailingCursor = mod.trailingCursor as any;
        cursor = new TrailingCursor();
      }
    });
    return () => {
      isMounted = false;
      if (cursor && typeof cursor.destroy === "function") {
        cursor.destroy();
      }
    };
  }, []);

  return null;
}
