© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•12mo ago•
6 replies
Mango

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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Blazor reactive state
C#CC# / help
2y ago
Blazor Date Picker Component
C#CC# / help
2mo ago
❔ Razor Component vs View Component vs Blazor
C#CC# / help
3y ago
❔ Blazor sub-component PageTitle overrides parent component?
C#CC# / help
3y ago