New DndProvider multiple HTML5 backends issue
See original GitHub issueDescribe the bug
Since using the new DndProvider
I get an Cannot have two HTML5 backends at the same time. error after re-rendering the component where DndProvider
is set.
According to the documentation the DndProvider
should be at the very top of the application but only one re-render will break the whole app. Also when using the react-router it’s not the best idea to always place it at the top.
To Reproduce Steps to reproduce the behavior:
- Place the
DndProvider
in a component - Cause a re-render e.g. with useState
- Application will break
Expected behavior
The DndProvider
should use the already created backend.
Example https://codesandbox.io/s/gs988
Additional context
The legacy HOC DragDropContext
didn’t have this issue.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
React DnD - "Cannot have two HTML5 backends at the same ...
I faced with similar issue and found workaround by moving <DragDropContextProvider></DragDropContextProvider>.
Read more >Troubleshooting - React DnD - GitHub Pages
This page is dedicated to the problems you might bump into while using React DnD. ... Currently React DnD only provides an HTML5...
Read more >react-dnd-multi-backend - npm
DndProvider (new API). You can use the DndProvider component the same way you do the one from react-dnd (docs for more information), ...
Read more >"Cannot have two HTML5 backends at the same time."-Reactjs
You can either create a new file and import DragDropContext where you need it: import HTML5 from 'react-dnd-html5-backend'; import {DragDropContext} from ...
Read more >react-dnd-html5-backend examples - CodeSandbox
Learn how to use react-dnd-html5-backend by viewing and forking react-dnd-html5-backend example apps on CodeSandbox.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in https://github.com/react-dnd/react-dnd/pull/1422, which will be released in the next patch version