Skip to content

Delete store array item by setting undefined causes rendering error #1750

Answered by snnsnn
leaysgur asked this question in Q&A
Discussion options

You must be logged in to vote

If you are going to remove an item, filter the item and set the resulting array as the new value.

setState("items", arr.filter(el => el.id !== 1))

If you are going to update, you can map over the items and set the resulting array as the next value. Alternatively you can use path pattern: https://www.solidjs.com/docs/latest/api#updating-stores

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@atk
Comment options

@snnsnn
Comment options

Answer selected by ryansolid
Comment options

You must be logged in to vote
1 reply
@leaysgur
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #1748 on May 30, 2023 23:30.