Re-rendering a child when its prop changes in onRest #1804
Unanswered
Sp1d3rbite
asked this question in
Support
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I have prototype where the user steps through a chat-like conversation.
Right now the user picks an option and it, and the responses to it, will display in order because the array they're in gets updated. To be clear, this part works excellent!
What I wanted to add was the ability to first display a message with a '...', as if the recipient is typing, and after the animation of that particular message is completed, switch to the final text.
I assumed this would pretty easy with the onRest event. Just flip the boolean there, the state change notifies the child, which listens to that with an useEffect, which updates the test accordingly.
But this seems not the case.
It IS updating the boolean properly, just not updating the component. I know this because the messages remain on '...' UNTIL I hover my mouse over it, updating the text instantly.
What else is strange is that when debugging the boolean value at the top of the component whenever it renders it is always true (even though I'm expecting it to be false at first)
Below is a gif showcasing the hover behaviour.
Anyone got a clue what I'm missing? Not really sure if the issue is React-Spring related but it seems my implementation of the transitions has an effect on it.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions