DEV Community

Discussion on: Super easy react mount/unmount animations with hooks

Collapse
 
michalczaplinski profile image
Michal Czaplinski

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!