You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 2, 2021. It is now read-only.
The problem comes if you want to then pass the &mut dyn RootRender to a future, for example if you want to update state based on some asynchronous event like an api call. Because futures must be 'static, there's no way to do it.
A potential solution would be for that field to give you something like Rc<Box<dyn RootRender>>, thereby giving you ownership, so you can use it at any point in the future.
What do you think about this?
EDIT I guess it would need to be Rc<RefCell<dyn RootRender>> so you could mutate the state.
When you want to respond to a user event, you use the following builder method
The problem comes if you want to then pass the
&mut dyn RootRenderto a future, for example if you want to update state based on some asynchronous event like an api call. Because futures must be 'static, there's no way to do it.A potential solution would be for that field to give you something like
Rc<Box<dyn RootRender>>, thereby giving you ownership, so you can use it at any point in the future.What do you think about this?
EDIT I guess it would need to be
Rc<RefCell<dyn RootRender>>so you could mutate the state.