We will look at how to delete a shape that we have stored in an array. You'll see how we can continue building functionality by composing atoms together to achieve what we want.
For this feature, we will need to create a few atoms to add the functionality needed. We will start by creating selectedAtom
and unselectAtom
. selectedAtom
is a getter for the selected Shape and unselectAtom
will be used to clear the selection when an atom is deleted.
When these two functions are set, we can create a deleteSelectedShapeAtom
which will filter out the selected atom that is held in shapeAtomsAtom
. And finally, we'll wire this up to a button to actually use!