When the child component calls the parent component's state, the state of isIntersecting is reset #703
Closed
condorheroblog
started this conversation in
General
Replies: 2 comments
|
You have multiple observers that update the same context state in a |
0 replies
|
I'm so sorry🤦♂️. I forgot that there are three child components on my page. Thank you. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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.
Print the value of
entry?.isIntersectingwhen scrolling, and its value first changes totrueand then tofalse. I don't know why.But if I don't use handleSetNum function everything is normal - one
true.All reactions