reorder
This commit is contained in:
@ -48,6 +48,18 @@ export interface DndListProps {
|
||||
dataprops: DndListProps;
|
||||
}
|
||||
|
||||
const reorder = ({ from, to }: { from: number; to: number })
|
||||
{
|
||||
const cloned = [...current];
|
||||
const item = current[from];
|
||||
|
||||
cloned.splice(from, 1);
|
||||
cloned.splice(to, 0, item);
|
||||
|
||||
return cloned;
|
||||
};
|
||||
|
||||
|
||||
export function DndList({dragEndHandler, dataprops}: IProps)
|
||||
{
|
||||
const {data} = dataprops;
|
||||
|
||||
Reference in New Issue
Block a user