adospace / reactorui-maui

MauiReactor is a MVU UI framework built on top of .NET MAUI
MIT License
587 stars 49 forks source link

Update function with messages (feature request?) #250

Closed juliusdeblaaij closed 1 week ago

juliusdeblaaij commented 3 weeks ago

Hello, thank you for this sleak library! I was wondering about the possibility of an Update function. I know about SetState, but I feel that using SetState will spread out my business logic through my UI.

I was wondering if you had any thoughts on an Update function, which given the current State, a message ("set name") and some optional data (like a name string) Would:

I'm interested to get to know your outlook. Not even necessarily as a feature request, since it might be too opinionated, but maybe just implementation guidance.

Kind regards,

Julius

adospace commented 2 weeks ago

Hi, MauiReactor by design doesn't provide a full state manager (most like Flutter or React don't).

Any developer or team can choose the state manager that best fits its application requirements (one could also opt not to use a state manager at all). From your description, it seems you are pointing to a Flux-like state manager. For that, you could take a look at Fluxor or Memento. This is a possible integration of Flux for MauiReactor: https://gist.github.com/adospace/cbede42c410c642dbdbcafe9ece5e90b

Rearch is another full-state manager inspired by Riverpod that has native integration with MauiReactor https://github.com/nabond251/rearch-dotnet

Of course, you can be also completely free to add your state manager on top of MauiReactor.

Not sure about your contest but maybe you could just use injected services to handle the logic that are also easier to test.

juliusdeblaaij commented 1 week ago

Thank you for your clear answer. If I take a page out of the React book, there are so many different appraoches to state... so the flexibility of MauiReactor is perfect. No need for this enhancement :)