-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
It would be nice to have some guidance on best practices regarding state sharing between Relm4 components. These are the options I've considered so far:
- Introduce global state using SharedState. This is relatively easily to implement but may make it harder to write isolated automated tests. The tab_game example uses this approach.
- Pass down references to child components. I tried this at some point and got stuck trying to express the lifetime constraints.
- Perhaps passing down RefCell/RefMut variables could work. Haven't tried this yet. It may sidestep lifetime issues but could introduce runtime panics if not managed properly.
- Rely fully on message passing as opposed to shared state. This may be elaborate to maintain especially if there's a big hierarchy in your components.
djmaze
Metadata
Metadata
Assignees
Labels
No labels