Search code examples
reactjscreate-react-appreact-beautiful-dnd

add react-beautiful-dnd has warnings; doesn't work


I'm working through the author's tutorial, task-app on https://egghead.io/courses/beautiful-and-accessible-drag-and-drop-with-react-beautiful-dnd. My code is identical, but the app does not work. Could it be because of the warnings? This is my first attempt to use react outside of codeSandbox. I started with >npx create-react-app task-app, imported styled-components, which worked, and then typed >yarn add react-beautiful-dnd. Among others, the following warnings appeared:

warning " > react-beautiful-dnd@13.0.0" has incorrect peer dependency "react@^16.8.5".

warning " > react-beautiful-dnd@13.0.0" has incorrect peer dependency "react-dom@^16.8.5".

Finally, drag and drop did not work even though my code was identical to the code in the tutorial.


Solution

  • use ref for HTML DOM element and use innerRef for React component https://github.com/atlassian/react-beautiful-dnd/blob/master/docs/guides/using-inner-ref.md#a-common-error-