Closed princeajuzie7 closed 5 months ago
my code has been working well then suddenly this error message started popping up.
"use client";
import { usePathname } from "next/navigation"; import { useEffect } from "react";
import { IStaticMethods } from "preline/preline"; declare global { interface Window { HSStaticMethods: IStaticMethods; } }
export function PrelineScript() { const path = usePathname();
useEffect(() => { const loadPreline = async () => { await import("preline/preline"); if (typeof window !== "undefined") {
window.HSStaticMethods?.autoInit(); } }; loadPreline();
}, [path]);
return null; }
Hey @princeajuzie7 - could you please provide working Stackblitz live demo and step by step details? You may fork the example demo here if needed.
my code has been working well then suddenly this error message started popping up.
"use client";
import { usePathname } from "next/navigation"; import { useEffect } from "react";
import { IStaticMethods } from "preline/preline"; declare global { interface Window { HSStaticMethods: IStaticMethods; } }
export function PrelineScript() { const path = usePathname();
useEffect(() => { const loadPreline = async () => { await import("preline/preline"); if (typeof window !== "undefined") {
}, [path]);
return null; }