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
What's the best or most idiomatic way to have per component instance data? Components are created and destroyed as needed when navigation occurs, but I want to persist some data, for instance for caching, when navigating back and forth.
At the moment I'm using an Rc<RefCell<T>> wrapper to some state struct which is passed to the component as a property, but that seems quite verbose. I don't like the Rc/RefCell wrapper either and I'd like to avoid it if possible.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
What's the best or most idiomatic way to have per component instance data? Components are created and destroyed as needed when navigation occurs, but I want to persist some data, for instance for caching, when navigating back and forth.
At the moment I'm using an
Rc<RefCell<T>>
wrapper to some state struct which is passed to the component as a property, but that seems quite verbose. I don't like the Rc/RefCell wrapper either and I'd like to avoid it if possible.Beta Was this translation helpful? Give feedback.
All reactions