Replies: 1 comment 2 replies
-
We can go with the second approach, but I prefer to return a predefined symbol: // from elf
export const REMOVE_ENTITY = Symbol()
// in the app
updateEntities(productId, (item) => (item.count > 1 ? { ...item, item.count - 1 } : REMOVE_ENTITY)) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I think it would be helpful to have an opposite updater to the upsert.
upRemove
,updateOrRemove
?The one that could update or remove the entity if some condition is met. I know it's pretty easy to make it in your own app if you need it, but if there is
upsert
then the counterpart is kinda asking to be there.Like:
I can add it if you agree.
Or maybe the regular update could accept
undefined
ornull
when the item should be removed?Like:
Beta Was this translation helpful? Give feedback.
All reactions