Hi. I have a component with few TextFields. I have...
# mvikotlin
b
Hi. I have a component with few TextFields. I have Store and I have Intents like
SetPassword
SetUsername
SetDomain
etc. Should I for each Intent create corresponding Result (
SetPassword
-
PasswordChanged
,
SetUsername
-
UsernameChanged
), or there is simplest solution (but compliant with the best practices)?
a
Hello! A proper solution would be to have separate
Result
classes. But if you really wan't to simplify, you can change the state in
Executor
and have just one
Result.NewState(State)
. Or you can event have
Result.StateChange(val update: (State) -> State)
, but it will prevent
Result
serialization if you care about the Time Travel feature. Also please note that in simplest cases when you don't have any async job in your
Executor
and you don't need the
Bootstrapper
, you can avoid
Executor
at all and process
Intents
directly in the
Reducer
.
👍 1
b
Thank you!