If passing data between your Blazor components is too painful...
In a previous article I wrote about a few options for passing state between Blazor components.
In truth those options will serve you well for many, many Blazor applications, but if you’re finding it painful to pass state between components using parameters, callbacks and binding, you might need something else.
Once you have multiple components at different levels in your application, passing state around between them can quickly spiral into a bit of a maintenance nightmare.
An alternative is to employ centralised state management with a library like Fluxor, or Blazor-State.
With both of these libraries you create a ‘Store’ for your application, wire your components up to that store and then they’re able to react as that state changes.
NOTE
No such thing as a free lunch
It’s worth pointing out before you continue that nothing is free, especially in software development and adopting something like Blazor-State or Fluxor does cost (in terms of time to learn, implement and ultimately maintain the application) but if the other options don’t cut it, it might be worth a look.
For the rest of this article we’ll focus on Blazor-State.