-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
Labels
Description
Hi,
I'm unable to set a class to the children items.
The following code
const [state, setState] = useState([
{ id: 1, name: "shrek" },
{ id: 2, name: "fiona" }
]);
return (
<ReactSortable
className="my-list"
list={state}
setList={setState}
>
{state.map(item => (
<div className="my-item" key={item.id}>{item.name}</div>
))}
</ReactSortable>
);
ends up like this
<div class="my-list">
<div data-id="1" class="my-list">shrek</div>
<div data-id="2" class="my-list">fiona</div>
</div>
Looks like it comes from a misplaced line in the following commit c93847e
The prevClassName
variable is declared at the beginning of the getChildren
function. Moving it into the Children.map
part fixed the problem locally.