Doing something in the component on the receipt of the action #278
-
In my component that is subscribed to a state likes so What's the most appropriate way of doing so? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
The state can only change by handling an Action. If you want to do "something else" then I would either update the handler of the Action or raise a INotification and register a notification handler. Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
It does. But I think I am still missing a piece. Consider this though. I have a DisplaySizeState (using blazor state) that keeps track of display size breakpoints. Then I have a relatively complex Component that has a bunch of local variables that are meant to be set according to their own logic based on the display size breakpoints. These variables have no context outside this component and setting them all up in individual actions would just be clutter and bad separation imho. How what I go about dealing with this? Are you saying I should be raising a INotification in the handler and then registering a notification handler in the Component? Isn't that kind of double pipelining (for the lack of better term) if you will? |
Beta Was this translation helpful? Give feedback.
It does. But I think I am still missing a piece. Consider this though.
I have a DisplaySizeState (using blazor state) that keeps track of display size breakpoints.
Then I have a relatively complex Component that has a bunch of local variables that are meant to be set according to their own logic based on the display size breakpoints. These variables have no context outside this component and setting them all up in individual actions would just be clutter and bad separation imho.
How what I go about dealing with this? Are you saying I should be raising a INotification in the handler and then registering a notification handler in the Component? Isn't that kind of double pipelining (for the …