我希望你能帮助我,我一直在努力寻找awnser,但我没有找到它与我正在使用的库堆叠在一起
我正在try 使用JS实现Reaction-Easy-Sort
const [items, setItems] = useState(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'])
const onSortEnd = ({oldIndex, newIndex}) => {
setItems(({items}) => ({
items: arrayMove(items, oldIndex, newIndex),
}));
};
要返回,请执行以下操作:
<SortableList onSortEnd={onSortEnd} className="list" draggedItemClassName="dragged">
{items.map((item) => (
<SortableItem key={item}>
<div className="item">{item}</div>
</SortableItem>
))}
</SortableList>
However when dragging on of the values from place to place I get the following error: