Migration from v1.x to v.2.x shouldn't be difficult and should take under 10 minutes.
Three sections: State, Options and hooks.
With the old version you used to have to:
onChange
[].sort()
setState()
// example from old — state
The new way is to:
state
list
setList
// example from new — state
Options used to be a prop on the react-sortable component.
Options
react-sortable
// example from old — options
Now each property of Options is a prop. You can still separate your options if you wish and then merge the props.
// example from new — options
My favourite addition to this component is hooks.
We used to have no other choice but use a component as the container for the list that contains sortable items.
// example from old — component
Now we can use a hook that takes 2 object parameters.
The first argument contains properties that affect state: list, setList and clone.
clone
The second are the Sortable options.
// example from new — hooks
There was an error while loading. Please reload this page.
dfdf