←back to thread

205 points samspenc | 2 comments | | HN request time: 0.527s | source
Show context
adithyassekhar ◴[] No.45146246[source]
This reminded me, I saw tooltips being a large chunk when I profiled my react app. I should go and check that.

Similarly, adding a modal like this

{isOpen && <Modal isOpen={isOpen} onClose={onClose} />}

instead of

<Modal isOpen={isOpen} onClose={onClose} />

Seems to make the app smoother the more models we had. Rendering the UI (not downloading the code, this is still part of the bundle) only when you need it seems to be a low hanging fruit for optimizing performance.

replies(4): >>45146382 #>>45146410 #>>45147091 #>>45147510 #
aiiizzz ◴[] No.45147091[source]
That breaks the out transition.
replies(8): >>45147226 #>>45147342 #>>45147669 #>>45148400 #>>45148647 #>>45150589 #>>45150865 #>>45153296 #
1. abdusco ◴[] No.45147669[source]
Even when using view transitions?

https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-s...

replies(1): >>45147893 #
2. csande17 ◴[] No.45147893[source]
The "Transitioning elements on DOM addition and removal" example in that article uses a setTimeout() to wait an extra 1000 milliseconds before removing the element from the DOM. If you immediately remove the element from the DOM (like would usually happen if you do {isOpen && <Modal />} in React), it'll vanish immediately and won't have time to play the transition.