8000 key does not equal index section · dasveloper/react-sortablejs@96430c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 96430c2

Browse files
author
Wayne Van Son
committed
key does not equal index section
1 parent 1bc26c3 commit 96430c2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ React component wrapping [SortableJS](https://github.com/SortableJS/Sortable) wr
66

77
- [x] Create examples from [SortableJS Examples](https://sortablejs.github.io/Sortable/)
88
- [ ] Create all tests for examples (for 'ron)
9-
- Currently we;ve got a few.
9+
- Currently weve got a few.
1010
- [ ] Test the following UI component libraries:
1111
- [ ] MaterialUI
1212
- [ ] AntD
@@ -20,6 +20,8 @@ React component wrapping [SortableJS](https://github.com/SortableJS/Sortable) wr
2020

2121
### SortableJS
2222

23+
Everything you love about SortableJS, including to but not limited to:
24+
2325
- [x] Drag and Drop between lists
2426
- [x] Multidrag and Swap plugin support.
2527

@@ -55,7 +57,7 @@ import React, { FC, useState } from "react";
5557
import { ReactSortable } from "react-sortablejs-typescript";
5658

5759
interface ItemType {
58-
id: string;
60+
id: number;
5961
name: string;
6062
}
6163

@@ -193,6 +195,14 @@ This component reverses many of it's actions of the DOM so React can handle this
193195

194196
## Caveats / Gotchas
195197

198+
### `key !== index`
199+
200+
DO NOT use the index as a key for your list items. Sorting will not work.
201+
202+
In all the examples above, I used an object with an ID. You should do the same!
203+
204+
I may even enforce this into the design to eliminate errors.
205+
196206
### `setState()`
197207

198208
#### Problem

0 commit comments

Comments
 (0)
0