If when I switch from rendering big component A to rendering big component B, and it takes 2 seconds for B to appear, so I want to add some fade animation to make the user feel it's more responsive. In my case, if I fade out A, does B start being calculated from start of fade or end of fade?
Hi! Sorry for the late reply, I must have missed your comment earlier.
The code that I have shown above is not appropriate for the use case that you have described. Notice, that I am not fading in and out two different components A and B. I am wrapping a component A with a so that I can fade it in and out when I want. So, there is no notion of "start of fade" and "end of fade" - you would have to create that yourself.
As a side note: I don't believe you would ever have a use case like you described. No component (no matter how big) should ever take 2 seconds to render (not even at facebook scale). The only case when that should happen is if the component is fetching some data after having been mounted. But this would be unrelated to the fading mechanism that I described above.
Hope this helps, let me know if you have more questions!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If when I switch from rendering big component A to rendering big component B, and it takes 2 seconds for B to appear, so I want to add some fade animation to make the user feel it's more responsive. In my case, if I fade out A, does B start being calculated from start of fade or end of fade?
Hi! Sorry for the late reply, I must have missed your comment earlier.
The code that I have shown above is not appropriate for the use case that you have described. Notice, that I am not fading in and out two different components A and B. I am wrapping a component A with a so that I can fade it in and out when I want. So, there is no notion of "start of fade" and "end of fade" - you would have to create that yourself.
As a side note: I don't believe you would ever have a use case like you described. No component (no matter how big) should ever take 2 seconds to render (not even at facebook scale). The only case when that should happen is if the component is fetching some data after having been mounted. But this would be unrelated to the fading mechanism that I described above.
Hope this helps, let me know if you have more questions!