Open Felix-Franz opened 3 years ago
You can use the lib much easier if you would include this:
import {SortableContainer, SortableElement, SortableHandle} from "react-sortable-hoc"; const component = ({children}: {children: JSX.Element}) => children; export const SortableItem = SortableElement(component); export const SortableList = SortableContainer(component); export const SortHandle = SortableHandle(component);
Usage:
<SortableList> <ul> {this.state.elementForList.map((c, i) => <SortableItem key={i} index={i}> <li>{c}</li> </SortableItem> </ul> )} </SortableList>
Thanks for this. I created a sortableUtils.ts which exports these consts, and this does make it sooooo much more pleasant to use.
sortableUtils.ts
You can use the lib much easier if you would include this:
Usage: