Get started with react-sortable-hoc CDN
MIT licensed
React-sortable-hoc is a Higher Order Component for implementing sortable functionality in React lists.
Tags:- react
- reactjs
- react-component
- sortable
- sortable-list
- list
- sortable list
- smooth
- animated
- hoc
- higher-order
- component
- drag-and-drop
- sorting
- javascript
- front-end
- dragging
- grid
- higher-order-component
Stable version
Copied!
How to start using react-sortable-hoc CDN
import React from 'react';
import SortableFunc from 'https://cdn.cdnhub.io/react-sortable-hoc/2.0.0/react-sortable-hoc.min.js';
const SortableList = SortableFunc(props => {
return (
<ul style={{ listStyleType: 'none', padding: 0 }}>
{props.items.map((item, index) => (
<li key={item.id}>
{item.label}
<button onClick={() => props.removeAt(index)}>Remove</button>
</li>
))}
</ul>
);
}, { handle: '0.5* [transform]' });
const MyComponent = () => {
const [items, setItems] = React.useState([
{ id: 1, label: 'Item 1' },
{ id: 2, label: 'Item 2' },
{ id: 3, label: 'Item 3' },
]);
const handleRemoveAt = index => {
setItems(prevItems => prevItems.filter((_, i) => i !== index));
};
return <SortableList items={items} removeAt={handleRemoveAt} />;
};
export default MyComponent;
All versions
0.0.1
0.0.10
0.0.11
0.0.2
0.0.3
0.0.4
0.0.5
0.0.6
0.0.7
0.0.8
0.0.9
0.1.0
0.1.1
0.2.0
0.3.0
0.4.0
0.4.1
0.4.10
0.4.11
0.4.12
0.4.2
0.4.3
0.4.4
0.4.5
0.4.6
0.4.7
0.4.8
0.4.9
0.5.0
0.6.0
0.6.1
0.6.2
0.6.3
0.6.4
0.6.5
0.6.6
0.6.7
0.6.8
0.7.0
0.7.1
0.7.2
0.7.3
0.7.4
0.8.0
0.8.1
0.8.2
0.8.3
0.8.4
0.9.0
0.9.0-beta
1.0.0
1.1.0
1.10.0
1.10.1
1.11.0
1.2.0
1.3.0
1.3.1
1.4.0
1.5.0
1.5.1
1.5.2
1.5.3
1.5.4
1.6.0
1.6.1
1.7.0
1.7.1
1.8.0
1.8.1
1.8.2
1.8.3
1.9.0
1.9.1
*** 2.0.0