remove element from store array createStore([])
hi, i need to move element in store to the front of the array or delete it and add it to the front. i used signals, now switching to store.
const rect = board.getBoundingClientRect()
const card = cards[cardIdx]
const newCards = cards
newCards.splice(cardIdx, 1)
setCards([{...card, position: { x: e.clientX - offsetX - rect.left, y: e.clientY - offsetY - rect.top}}, ...newCards])
//this is how the card object looks like, the store is array of those objects
const card = {
title: "Card 4",
body: "This is the body of the second card",
color: "green",
position: { x: 10, y: 50 },
velocity: { x: 0, y: 0 },
pins: [],
div: undefined,
id: 3
}