Not able to use initialized State from a function. #303
-
Currently I'm trying to get to understand, what the differences between this to State initializations are: Example 1:
Example 2:
I'm asking this, because if I'm using the Example one, the State is somehow not mutable. However, if I use the Example 2 my State is indeed mutable and I'm able to drag Items without problems. Example of my Test. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
They're both equivalent. The only difference is that in one of them you have an You can't safely use numbers for the https://codesandbox.io/s/festive-sara-nwh5c?file=/src/App.js |
Beta Was this translation helpful? Give feedback.
They're both equivalent. The only difference is that in one of them you have an
id
that is0
whereas the other ones start at1
.You can't safely use numbers for the
id
that you pass to@dnd-kit
, they have to be strings. Refer to #286 (comment)https://codesandbox.io/s/festive-sara-nwh5c?file=/src/App.js