react-sortable-hoc icon indicating copy to clipboard operation
react-sortable-hoc copied to clipboard

TypeError: Cannot read properties of undefined (reading 'add')

Open ujwaldeepsc20y opened this issue 3 years ago • 1 comments

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>
   );
 }

ujwaldeepsc20y avatar Oct 28 '22 06:10 ujwaldeepsc20y

Facing the same issue after upgrading to react 18.. Uncaught TypeError: this.context.manager.add is not a function image

Raviteja7714 avatar Apr 02 '24 16:04 Raviteja7714