-
I'm trying to figure out where to draw the line between using a regular struct as part of my view model vs using a reducer. A semi-contrived example follows. Let's say we have a tagged string representing a line of text and a tagged int to represent the column in the string (column doesn't start at 0, but at 1).
Since, we are defining our Ranges on
This works great. But, there are some complicated checks and balances in the mutating methods on
Applying these methods to Is there a better way to approach this using Reducer's or am I better off just using a plain old struct? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @georgemp, I believe this problem is best left to a plain struct with some methods/functions defined on it. And it is still completely testable as a standalone type. It is best to leave reducers to full features of your app where actions correspond to things the user did in the UI. |
Beta Was this translation helpful? Give feedback.
Hi @georgemp, I believe this problem is best left to a plain struct with some methods/functions defined on it. And it is still completely testable as a standalone type.
It is best to leave reducers to full features of your app where actions correspond to things the user did in the UI.