Skip to content

When the child component calls the parent component's state, the state of isIntersecting is reset #702

@condorheroblog

Description

@condorheroblog

This link can be used to reproduce the scene: https://codesandbox.io/p/sandbox/isintersecting-is-reset-2xgfm3?file=%2Fsrc%2Findex.tsx%3A31%2C18

I updated the state of the parent component through the handleSetNum function in the child component.

image

Print the value of entry?.isIntersecting when scrolling, and its value first changes to true and then to false. I don't know why.

2024-09-11 17 32 03

But if I don't use handleSetNum function everything is normal - one true.

2024-09-11 17 33 01

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