0.0.0 • Published 9 months ago

react-basic-dnd v0.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Installation

npm

npm install react-basic-dnd

yarn

yarn add react-basic-dnd

pnpm

pnpm install react-basic-dnd

Usage

import { DraggableContainer, DraggableItem } from 'react-basic-dnd';

function App() {
  const [value, setValue] = useState([1, 2]);
  
  const handleChange = () => (newValue) => setValue(newValue);
  
  return (
    <DraggableContainer onChange={handleChange} value={value}>
      {value.map((item) => (
        <DraggableItem key={`item-${item}`}>
          <div
            style={{
              padding: 20,
              border: '1px solid'
            }}
          >
            ITEM {item}
          </div>
        </DraggableItem>
      ))}
    </DraggableContainer>
  )
}

export default App;