Conditional store update #41
Answered
by
NetanelBasal
strigefleur
asked this question in
Q&A
Replies: 1 comment 1 reply
-
function identity(state: any) {
return state;
}
store.update(
updateEntitites(..),
updateAllEntities(..),
condition ? updateEntitiesByPredicate(..) : identity,
) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
strigefleur
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there any possibility to refactor complex update code like this
into something more tiny?
Due to complex logic it takes different kinds of updates - and in order to keep those within one emit, I use plain if-else conditions. Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions