react-book icon indicating copy to clipboard operation
react-book copied to clipboard

react-dnd unsupported version automatically installed by webpack

Open danielhamngren opened this issue 5 years ago • 3 comments

I have been following the examples in the currently online book at https://survivejs.com/react/introduction/ and was using version 2.5.6 of the boilerplate.git from https://github.com/survivejs/react-boilerplate.git

When arriving at the chapter "Implementing Drag and Drop" I ran into a problem with the code, or rather the package management.

Webpack downloaded the new dependencies for react-dnd and react-dnd-html5-backend automatically as expected. The version automatically downloaded were 7.0.2 but then the code examples in https://survivejs.com/react/implementing-kanban/drag-and-drop/ didn't work.

I got the error TypeError: React.createContext is not a function.

In order to fix the error, I manually set the version of react-dnd and react-dnd-html5-backend in package.json. The latest version that works with the current code is 2.6.0.

danielhamngren avatar Feb 02 '19 22:02 danielhamngren

Hi, same issue here.

These are my dependencies:

"react": "^15.1.0",
"react-dnd": "^10.0.2",
"react-dnd-html5-backend": "^10.0.2",

What should be set to 2.6.0?

matteobortolazzo avatar May 01 '20 21:05 matteobortolazzo

Hi,

The demo project has been designed to work with the versions below:

    "react-dnd": "^2.1.4",
    "react-dnd-html5-backend": "^2.1.2",
    "react-dom": "^15.1.0",

Here's the source for reference: https://github.com/survivejs/react-book/tree/dev/project_source/implementing_kanban/06_drag_and_drop/kanban-app .

bebraw avatar May 02 '20 05:05 bebraw

Oh ok thanks! I didn't expect a jump from 10 to 2, but copying the whole package.json made it work!

matteobortolazzo avatar May 02 '20 14:05 matteobortolazzo