Skip to content

Why useInView cause the component to re-render twice? #592

Description

@gremo

First thank you 🙏 for this great library!

I'm rendering ProductsListViewItem 16 times in a list (first console.log). After adding useInView, there are two more renderings for each one. I would expect just one more rendering when inView pass from false to true.

exportconstProductsListViewItem=({ product }: ProductsListViewItemProps)=>{console.log('[ProductsListViewItem] Rendering...');const{ ref, inView }=useInView({triggerOnce: true,delay: 500});return(<divref={ref}></div>);}

Immagine 2022-11-22 115548

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions