0

I'm trying to convert beautiful-dnd to functional components and split them into different components but I'm just wondering why this is throwing an error?

Edit react-beautiful-dnd tutorial

Thanks,

Freddy.
  • 1,593
  • 2
  • 20
  • 32

1 Answers1

0

There was an issue in task.js. You forgot to spread the provided.dragHandleProps

import React from 'react'
import { Draggable } from 'react-beautiful-dnd'

const Task = props => {
  console.log(props)
  return (
    <Draggable draggableId={props.task.id} index={props.index}>
      {(provided, snapshot) => (
        <div
          ref={provided.innerRef} // <-- this as well
          {...provided.draggableProps}
          {...provided.dragHandleProps} // <-- here
        >
          {props.task.content}
        </div>
      )}
    </Draggable>
  )
}

export default Task
Murli Prajapati
  • 8,833
  • 5
  • 38
  • 55