react-sortable-hoc
react-sortable-hoc copied to clipboard
TypeError: Cannot read properties of undefined (reading 'add')
Not sure why this error is coming up while using SortableElement. Here is the code snippet I am using
const DragHandle = SortableHandle(() => <span>::</span>);
const DraggableContainer = SortableContainer(({ children }) => {
return <ul>{children}</ul>;
});
const DraggableElement = SortableElement(({ value }) => (
<li value={value}>
<DragHandle />
{value}
</li>
));
and here is how I am using the above components in render
render() {
return (
<DraggableContainer
useDragHandle
// getContainer={this.getContainer}
// helperContainer={this.getHelperContainer}
// onSortEnd={this.handleSortEnd}
>
<DraggableElement key={`item-1`} index={0} value={1} />
<DraggableElement key={`item-2`} index={1} value={2} />
</DraggableContainer>
);
}
Facing the same issue after upgrading to react 18..
Uncaught TypeError: this.context.manager.add is not a function