NextJS App Router SSR scroll animation
Unanswered
Sloth bear posted this in #help-forum
Sloth bearOP
Hello!
I'm using NextJS 13 with the new App Router and I'm trying to find a library that allows me to animate components on scroll that works without having my component set as "use client";
I've tried react-animation-on-scroll which states that it's compatible with SSR, but it won't work without "use client";
I'm using NextJS 13 with the new App Router and I'm trying to find a library that allows me to animate components on scroll that works without having my component set as "use client";
I've tried react-animation-on-scroll which states that it's compatible with SSR, but it won't work without "use client";
6 Replies
Using 'use client' means converting a component to a client component. This is necessary because it is not possible to perform animations on the server-side. Animation libraries like
react-spring, framer-motion, react-transition-group are not support in SSR.Sloth bearOP
Yes but is there a way to do that without any javascript
You are able to make animations in css and that doesn't require the component to be a client component
onScroll in itself is a javascript event therefore you need js for it to work
Sloth bearOP
errr
Is there a way to have the component server-sided for greater SEO but hydrate only the js necessary for animations then ?