react-intersection-observer icon indicating copy to clipboard operation
react-intersection-observer copied to clipboard

Your library is not working on NextJS14

Open julio-payligit opened this issue 1 year ago • 2 comments

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().

julio-payligit avatar Feb 18 '24 04:02 julio-payligit

Can you share the component you try it in?

thebuilder avatar Feb 19 '24 08:02 thebuilder

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?

thebuilder avatar Feb 19 '24 10:02 thebuilder

@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

federicogomezlara avatar Jul 16 '24 10:07 federicogomezlara