Next.js and GSAP rendering
Hey guys.
So I am working with GSAP pretty heavily and obviously I don't want to rely too much on the 'use client' directive.
So I decided to write my components like this:
Component.tsx -> Data setup and HTML Rendering
Component.animations.tsx -> Animations / Interactivity [use client]
Component.module.css -> CSS Stuff
So the idea was to separate animations from the actual content so I can benefit from server side rendering and animations as well. I'm pretty sure its an okay solution but wanted to ask the hive mind:
is that viable? am I wasting my time? forgetting anything?
Thanks!
1 Reply
client components are still rendered on the server on the first request, 'use client' is fine, don't overcomplicate things. Loading data with server components is great for performace, so use them for this.