Live data from Hacker News

Speeding up Unreal Editor launch by not spawning unused tooltips

larstofus.com

91–92 of 92 posts

Re: Speeding up Unreal Editor launch by not spawning unused tooltips

#91
post #83

Earlier quoted context omitted.

I mean in react if it’s gone from the render tree, it’s gone. I know there are libs like transition-group but I honestly don’t understand how they work. And the “react way” is to have the UI reflect state. If the state says the modal is not being rendered, it should not be rendered

Yes, React’s main idea is f(state) -> UI; but what’s returned from render is a declarative specification of what the UI should be. It’s up to React (and library authors) to make sure the UI ends up as we specify without our app logic needing to be concerned with how that happens. I view managing transition out animations for a component removed from the render tree the same way: I’m happy if the incidental complexity…

For anyone curious, here's a proof-of-concept of how to implement a that manages its own transition out when it's unmounted using just ReactDOM.createPortal and React.useLayoutEffect.

https://stackblitz.com/edit/react-modal-with-transition-out?...

Re: Speeding up Unreal Editor launch by not spawning unused tooltips

#92
post #91
post #83

Earlier quoted context omitted.

Yes, React’s main idea is f(state) -> UI; but what’s returned from render is a declarative specification of what the UI should be. It’s up to React (and library authors) to make sure the UI ends up as we specify without our app logic needing to be concerned with how that happens. I view managing transition out animations for a component removed from the render tree the same way: I’m happy if the incidental complexity…

For anyone curious, here's a proof-of-concept of how to implement a that manages its own transition out when it's unmounted using just ReactDOM.createPortal and React.useLayoutEffect. https://stackblitz.com/edit/react-modal-with-transition-out?...

awesome thanks!!

Ok it all makes sense now. I’d forgotten about useLayoutEffect. Haven’t had to write much react recently.

Post reply on HN