Sha256: 5b4b87b841cd28f5e3ead18a2a948328fbef7d1fc42c85b0770c7443a6e4907a
Contents?: true
Size: 913 Bytes
Versions: 7
Compression:
Stored size: 913 Bytes
Contents
import React, { useState } from "react"; import { DraggableProvider, List, ListItem } from "../../"; // Initial items to be dragged const data = [ { id: "31", text: "Philadelphia", }, { id: "32", text: "New Jersey", }, { id: "33", text: "Maryland", }, { id: "34", text: "Connecticut", }, ]; const DraggableWithList = (props) => { const [initialState, setInitialState] = useState(data); return ( <> <DraggableProvider initialItems={data} onReorder={(items) => setInitialState(items)} > <List draggable {...props} > {initialState.map(({ id, text }) => ( <ListItem id={id} key={id} > {text} </ListItem> ))} </List> </DraggableProvider> </> ); }; export default DraggableWithList;
Version data entries
7 entries across 7 versions & 2 rubygems