8000 [examples] uses new filter api · andrewvmail/react-sortablejs@2240cbd · GitHub
[go: up one dir, main page]

Skip to content

Commit 2240cbd

Browse files
author
Wayne Van Son
committed
[examples] uses new filter api
1 parent 951c779 commit 2240cbd

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

examples/components/filter.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@ import { ReactSortable, ItemInterface } from "../../src";
33
import { Item, threes } from "../util";
44
import styled from "styled-components";
55

6-
function createState() {
7-
return threes().map((item, index) => ({
8-
...item,
9-
filter: index === 2
10-
})) as ItemInterface[];
11-
}
126

137
export function Filter() {
14-
const [list, setList] = useState(createState);
8+
const [list, setList] = useState(threes);
159
return (
1610
<ReactSortable
1711
filter=".filter"
@@ -20,7 +14,7 @@ export function Filter() {
2014
animation={150}
2115
>
2216
{list.map(item => (
23-
<CustomItem className={item.filter ? "filter" : ""} key={item.id}>
17+
<CustomItem key={item.id}>
2418
{item.name}
2519
</CustomItem>
2620
))}

0 commit comments

Comments
 (0)
0