Comments (10)
I was able to solve this by following tutods method but importing it into my layout file like this:
const AosInit = dynamic(() => import('./<path>/AOSInit'), { ssr: true });
(Remember to export AOSInit as default)
from aos.
Does anyone have any idea how to fix this in the Next 13?
from aos.
When and how do you call AOS.init()
? AOS is adding the class aos-init
during initialization. At hydration, Next.js then experiences a mismatch between the server and client. I'm not that experienced with Next.js, but I'm guessing that's the problem. A possible solution might be calling AOS.init()
in an effect. More information on the issue, you can find here: https://nextjs.org/docs/messages/react-hydration-error
from aos.
I handle the AOS.init()
in a "use client"
component:
'use client';
import AOS from 'aos';
import type { ReactNode } from 'react';
import { useEffect } from 'react';
import 'aos/dist/aos.css';
export const AosInit = ({ children }: { children: ReactNode }) => {
useEffect(() => {
AOS.init({
anchorPlacement: 'top-bottom',
mirror: true,
offset: -100,
once: false,
});
}, []);
return <>{children}</>;
};
from aos.
After that only call this component in my layout:
from aos.
I have the same problem using Next.js 13+, did you manage to solve it?
from aos.
Hi @renovatt, no.
Already try a few things, but no success.
from aos.
I also can't understand it, because I'm using it in other projects and I don't have this problem, I've already updated all the dependencies and nothing works, I removed some providers around it and also without success. I can not understand. @tutods
from aos.
Thanks @renovatt
from aos.
It seems like you're encountering a warning about a prop mismatch related to the className attribute when using AOS (Animate on Scroll) in your Next.js project. This warning typically occurs when the className generated on the server-side rendering (SSR) doesn't match the one generated on the client-side. This can happen if there's a difference in how components are rendered between server and client.
One common approach to address this is to ensure that components are rendered consistently on both the server and client sides. You might want to check if there are any dynamic or conditional rendering that could cause differences between SSR and client-side rendering. Additionally, you can use libraries like react-async-script to load AOS dynamically on the client side, which might help mitigate this issue.
from aos.
Related Issues (20)
- Animation trigger too early when using other script like "load more" cards HOT 1
- not working correctly with Next.js 13.4.19 HOT 7
- mobile responsive
- Using aos in Astro HOT 3
- AOS does not work for fetch data
- How to do an "exit animation" manually using AOS?
- Aos is not working properly HOT 1
- Scrolling HOT 1
- Not Working With Angular SSR Version 17 HOT 2
- Aos not working on Tailwind Css ..... HOT 3
- Parent element (body) isn't my main content element HOT 1
- AOS Animating each time a user visit to section HOT 2
- GH pages and AOS
- Animations are popping in and out on iPhone using Chrome browser HOT 1
- AOS on Solid Start
- `[Deprecation] Listener` added for a 'DOMNodeRemoved' mutation event HOT 2
- Can not show elements on mobile with disabled option
- AOS not working in IONIC + React project.
- aos not displaying content expected to to fade in HOT 1
- Menu-Card
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aos.