Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next.js - TypeError: Cannot read properties of undefined (reading 'quickSetter') #26

Open
Ericnsamba opened this issue Mar 13, 2023 · 0 comments

Comments

@Ericnsamba
Copy link

Ericnsamba commented Mar 13, 2023

Hey Guys, this is my first time using mouse-follower, I'm using Next.js and Tailwind and this is my layout.tsx in appDir. I'd appreciate any help 馃檹

I'm getting the following error when I use the lib:

image

"use client";
import { useEffect, useRef, useState } from "react";
import { AnimatePresence} from "framer-motion";
import gsap from "gsap";
import Lenis from "@studio-freight/lenis";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { usePathname, useRouter } from "next/navigation";
import { MobileMenu } from "../components/Navigation/MobileMenu";
import NavBar from "../components/Navigation/Navbar";
import "../styles/globals.css";
import "../node_modules/locomotive-scroll/src/locomotive-scroll.scss";
import "../node_modules/mouse-follower/src/scss/index.scss";
import MouseFollower from "mouse-follower";
useEffect(() => {

    const cursor = new MouseFollower({
      container: '.mf-container',
      speed: 0.3
    });

    const lenis = new Lenis({
      duration: 1.2,
      easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), 
      smooth: true,
      mouseMultiplier: 1,
      smoothTouch: false,
      touchMultiplier: 2,
      infinite: false,
    });

    function raf(time: any) {
      lenis.raf(time);
      ScrollTrigger.update();
      requestAnimationFrame(raf);
    }
    requestAnimationFrame(raf);
  });

return (
    <html>
      <head />
      <body
        data-scroll-container
        ref={ref}
        className=".mf-container flex bg-white min-h-screen flex-col container mx-auto max-w-screen-xl items-stretch dark:bg-black scrollbar-hide "
      >
        <AnimatePresence exitBeforeEnter mode="wait">
          <div className="data-scroll">{children}</div>
          <div data-cursor-stick=".stick-me" className="stick-me">Hover me to stick cursor!</div>
          <div className="nav hidden lg:flex bottom-10 fixed self-center">
            <NavBar />
          </div>
          <MobileMenu />
        </AnimatePresence>
      </body>
    </html>
  );

@Ericnsamba Ericnsamba changed the title TypeError: Cannot read properties of undefined (reading 'quickSetter') Next.js - TypeError: Cannot read properties of undefined (reading 'quickSetter') Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant