Blazor cross component state mutation
What’s the best way to implement a theme switcher/toggle where one component on the layout gets the initial theme mode state, lets you switch, saves new value to db, but also needs to communicate the change to the rest of the component tree?
Currently I am trying an approach using SignalR and hubs to send a notification where another component picks up the state change and passes it down the heirarchy as a cascading parameter.
This works well although I’d rather not rely on SignalR if a singleton state manager with simple StateHasChanged invocation can happen. But I’m not sure how to do that given that the state is per user.
Thought?
Currently I am trying an approach using SignalR and hubs to send a notification where another component picks up the state change and passes it down the heirarchy as a cascading parameter.
This works well although I’d rather not rely on SignalR if a singleton state manager with simple StateHasChanged invocation can happen. But I’m not sure how to do that given that the state is per user.
Thought?