Skip to content

Object property in store is reactive when adding but not when removing #2150

Discussion options

You must be logged in to vote

So apparently there is a way to remove record items in a store. This is briefly mentioned in the docs but it didn't show any examples:
https://www.solidjs.com/docs/latest/api#updating-stores

basically the fix is to use undefined!. (The ! is for typescript non-null assertion)

So the change should be the following:

const onRemove = (id: string) => () => {
    props.setApp("data", "states", id, undefined!);
  };

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by pixelprogrammer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant