#React has `useLayoutEffect`; what would make sense with Dioxus?

1 messages · Page 1 of 1 (latest)

trim bison
#

I'm building a prototype Dioxus web app using absolute positioning. There are many <div>s that need to know their dimensions to prevent overlaps. (You could imagine that I'm using a force-directed layout if it helps visualize what I'm doing, but I'm not actually using that particular layout algorithm.)

For this application, it would be ideal to wait until layout finished but before painting starts. Agree?

React has useLayoutEffect. If Dioxus had this, it would seem like the ideal thing to use. Agree?

If the above makes sense, what would some good ways to proceed given the lack of useLayoutEffect? Perhaps using use_effect? Some other way?

Does the Dioxus team have any thoughts about implementing useLayoutEffect?

MDN Web Docs

Users want web experiences with content that is fast to load and smooth to interact with. Therefore, a developer should strive to achieve these two goals.

latent thorn
#

That probably makes sense to add to dioxus as well. That seems fairly simple to implement that for the web renderer. It is a bit tricker to implement that kind of hook correctly on desktop.

#

Could you open an issue?

#

If you are using the web renderer, I think you can get around first party support with web-sys