Sha256: 913fa45032d2c6e50ab7370903876e1cce0f140b02eb85dde37f47d0e57d2599
Contents?: true
Size: 1 KB
Versions: 5
Compression:
Stored size: 1 KB
Contents
import React, { useState } from "react"; import { SelectableList, DraggableProvider } from "../../"; // Initial items to be dragged const data = [ { id: "1", text: "Task 1", }, { id: "2", text: "Task 2", }, { id: "3", text: "Task 3", }, { id: "4", text: "Task 4", }, ]; const DraggableWithSelectableList = (props) => { const [initialState, setInitialState] = useState(data); return ( <> <DraggableProvider initialItems={data} onChange={(items) => setInitialState(items)} > <SelectableList draggable variant="checkbox" {...props} > {initialState.map(({ id, text }) => ( <SelectableList.Item id={id} key={id} label={text} name={id} value={id} /> ))} </SelectableList> </DraggableProvider> </> ); }; export default DraggableWithSelectableList
Version data entries
5 entries across 5 versions & 2 rubygems