react-anything-sortable icon indicating copy to clipboard operation
react-anything-sortable copied to clipboard

How to run 'modern usage'?

Open hantc opened this issue 8 years ago • 2 comments

Can't find out how to run sorting using 'modern usage' from docs

import React from 'react';
import { SortableContainer } from 'react-anything-sortable';

class SortableItem extends React.Component {
  render() {
    return (
      <SortableContainer>
        <div>
          your item
        </div>
      </SortableContainer>
    );
  }
};

is there any piece of important information missing? thanks

hantc avatar Aug 31 '16 08:08 hantc

A sortable container is a wrapper for an Item. you need to wrap it with Sortable. which you can get via:

import Sortable, { SortableContainer } from 'react-anything-sortable';

<Sortable>
    <SortableContainer>
        <div> Your Item. </div>
    </SortableContainer>
</Sortable>

w3nda avatar Sep 25 '16 13:09 w3nda

~~@hantc you should add @sortable to SortableItem component~~

What I said is wrong.

You shouldn't wrap SortableContainer in the SortableItem. You should put <SortableContainer> outside your own item.

Darmody avatar Oct 11 '16 21:10 Darmody