below worked
"use client";
import { ReactNode, useEffect } from "react";
import Lenis from "@studio-freight/lenis";
export default function SmoothScroll({ children }: { children: ReactNode }) {
useEffect(() => {
const lenis = new Lenis({
duration: 1.2,
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
orientation: "vertical",
lerp: 0.1,
smoothWheel: true,
touchMultiplier: 2,
});
function raf(time: number) {
lenis.raf(time);
requestAnimationFrame(raf);
}
requestAnimationFrame(raf);
return () => {
lenis.destroy();
};
}, []);
return <>{children}</>;
}