Jump to content
Search Community

NextJS 13 App Router GSAP Template

Deallie_Digital test
Moderator Tag

Recommended Posts

Hello All

 

When running performance insights with Chrome I am getting these details using the NextJs App Router, but in NextJs Pages Router everything works fine. Can someone please provide insight on how to properly load GSAP + Shockingly with the App Router or does anyone have a NextJS 13 App Router Template?

 

Thanks! 

Screenshot 2023-08-31 at 7.39.20 PM.png

Link to comment
Share on other sites

Hi,

 

This is the only template we have so far using the app router:

https://stackblitz.com/edit/nextjs-ysf649?file=README.md

 

When working with Next app router is a good practice to register ScrollTrigger and ScrollSmoother plugins inside the useLayoutEffect/useEffect hooks.

 

I never ran performance insights so I couldn't tell you about it honestly, but the fact that GSAP's tick is considered one of the longest functions certainly seems fishy to me TBH.

 

As for loading GSAP IDK what you mean about that, you just import GSAP in the files you need them and same with the plugins. If you have a main layout that can be used as a client component, then maybe register all the plugins in a single entry file would be a good approach as far as I can tell.

 

Hopefully this helps.

Happy Tweening!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...