Socket
Socket
Sign inDemoInstall

react-list-drag-and-drop

Package Overview
Dependencies
8
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-list-drag-and-drop

**This package has not been tested on mobile browsers or React Native. SORRY!**


Version published
Weekly downloads
1.1K
increased by7.7%
Maintainers
1
Install size
44.9 kB
Created
Weekly downloads
 

Readme

Source

React List Drag and Drop

This package has not been tested on mobile browsers or React Native. SORRY!

Build Status


React List Drag and Drop Example

React List Drag and Drop Example

Installation

npm install --save react-list-drag-and-drop

Usage

You must have an Array of items to render in your list.
Instead of rendering it inside a <div> you render it inside a <RLDD> component using a render prop.

import RLDD from 'react-list-drag-and-drop/lib/RLDD';
<RLDD
  items={items}
  itemRenderer={(item) => {
    return (
      <div className="item">{item.title}</div>
    );
  }}
  onChange={this.handleRLDDChange}
/>

Then you need to handle the onChange callback and call setState with the new list. Like this:

  private handleRLDDChange(newItems) {
    this.setState({ items: newItems });
  }

Each item must be of type Object and have an id property of type number.

You can play around with the examples

Typescript

Edit Draggable List for React + Typescript

Javascript

Edit Draggable List for React + Typescript

Keywords

FAQs

Last updated on 16 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc