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 |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm so sorry🤦♂️. I forgot that there are three child components on my page. Thank you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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?.isIntersecting
when scrolling, and its value first changes totrue
and then tofalse
. I don't know why.But if I don't use handleSetNum function everything is normal - one
true
.Beta Was this translation helpful? Give feedback.
All reactions