Is there a better way to remove an element from a Temp State Variable?

The only technique I have found to remove an array element from a temp state var is to extract the array, splice the element out and use setIn() to replace the original array with the new one.

Is there a better way to do this?

I haven't used setIn() (I didn't know about it until just now). I was doing something similar this past week though, and this was the solution I came up with:

My temp state has a structure like this:

Here is my little toy app where I was working out the idea.
localDbTest.json (75.1 KB)

Hmmm, that is a little weird and I must confess I had to download your app and test it out as I almost didn't believe it would work!

You are modifying the temp state value directly, but you must then set it to itself to get it to register with the environment.

Wow.

1 Like

I think setIn (or resetting the state value like Ben is doing) is the best/only way for now. I’ll double check with the team to see if they have any other methods!