-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AOS with NextJS - Document is not defined #709
Comments
I am facing the same problem right now. Were you able to solve it? |
Calling the init() inside useEffect worked for me useEffect(() => {
AOS.init()
}, []) |
import 'bootstrap/dist/css/bootstrap.min.css';
import '../styles/globals.css';
import '../styles/header.css';
import Layout from "../components/Layout";
import { useEffect } from "react";
import AOS from 'aos';
import 'aos/dist/aos.css';
function MyApp({ Component, pageProps }) {
useEffect(() => {
AOS.init({
startEvent: 'DOMContentLoaded',
initClassName: 'aos-init',
animatedClassName: 'aos-animate'
});
}, [])
return (
<>
<Layout>
<Component {...pageProps} />
</Layout>
</>
)
}
export default MyApp |
You are an amazingly maniac problem solver! Thank you! |
I try: useEffect(() => { and now I have this error: ` |
YOU ARE A BRO! |
Specifications
Document is Not Defined
So, I throug that the aos work normaly with nextjs, but I met with a problem in document, my eslint says that document is not defined
And in the browser a see this.!
I try catch the bug using dynamic import but nothing instead.!
The text was updated successfully, but these errors were encountered: