Closed devantler closed 3 years ago
I took a different approach.. base classes for getting data and finished getting data. My actions are all subclasses of these but then I have a reducer on the base class that updates a central loading state and error state. I only need to make one loading and error reporting UI for the whole application instead of handling every state.
Might be interesting to do a template pack with samples of different ways to handle state: https://docs.microsoft.com/en-us/dotnet/core/tools/custom-templates
I've been using Fluxor for quite a while now and noticed that I always create my own BaseState classes with shared properties across States. Mostly the IsLoading boolean to more elegantly show loader components in Blazor.
It would nice if Fluxor came with a BaseState class with nice to have properties to guide users in the right direction, instead of having us create a custom one for each project. My thoughts are that some properties like IsLoading are always useful, while others aren't. But having those default properties accessible from the get-go, removes some boilerplate code when setting up Fluxor.
E.g. something basic like this:
This then allows new users to use this base state to more easily follow the recommended practice like so:
@mrpmorris What do you think of such an approach?