react-intersection-observer
react-intersection-observer copied to clipboard
Your library is not working on NextJS14
Install your library ina nextjs14 project and you'll get: Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
As soon as you call useInView().
Can you share the component you try it in?
You say you're calling the useInView()
, but the error lists componentWillUpdate
and componentDidUpdate
, which comes from a React.Component
- Are you rendering the useInView
hook inside a function or a React.Component
class?
@julio-payligit I was getting the same error using the hook directly inside my Next page, once I placed the hook inside a separate component then imported said component into the page I stopped getting the error