You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a sortable list where each item is prepended with the number of the item in the list. This is all fine and working however while the user drags the item around, the numbers are not in the correct order. I got it to work by updating the state and thereby rerendering the entire list in the handleDragMove function however this feels like an incorrect solution and will likely run into performance issues. Indeed, in my testing, it does seem to mess up the functionality with the dragged item acting more chaotically and jerking around in the list.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to create a sortable list where each item is prepended with the number of the item in the list. This is all fine and working however while the user drags the item around, the numbers are not in the correct order. I got it to work by updating the state and thereby rerendering the entire list in the handleDragMove function however this feels like an incorrect solution and will likely run into performance issues. Indeed, in my testing, it does seem to mess up the functionality with the dragged item acting more chaotically and jerking around in the list.
Is there a better way to achieve this?
Beta Was this translation helpful? Give feedback.
All reactions