Cannot have two HTML5 backends at the same time
See original GitHub issueHi Dan,
Just a quick one - I’m trying to use my own component that has react-dnd
as a dependency in another app which itself uses react-dnd
so the error above expected. In this case, what would be the best way to fix this?
Since the other component is my own, I can remove the DragDropContext
call from while exporting the component but then that sacrifices the re-usability of the component. What do you advise?
Issue Analytics
- State:
- Created 8 years ago
- Comments:74 (13 by maintainers)
Top Results From Across the Web
Cannot have two HTML5 backends at the same time
Cannot have two HTML5 backends at the same time - Communication Site. Getting the following error in Edit Mode when we add more...
Read more >Cannot have two HTML5 backends at the same time #3178
Describe the bug I use different react-table draggable in different react-tabs My Index.js contains: import { HTML5Backend } from ...
Read more >React DnD - "Cannot have two HTML5 backends at the same ...
I have 3 components, first, the container call "Candidates", this component call 2 "CardBoard" components that call "Card" component. I user ...
Read more >cannot have two html5 backends at the same time. - Reddit
I have a single teams SharePoint site I access within my Teams app that when I browse to it I get an error...
Read more >React DnD Cannot have two HTML5 backends at the same ...
Insecure Resource. The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https....
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
Another approach that is a bit cleaner is to create a module that generates the decorator for a particular backend, and then use the decorator where needed:
lib/withDragDropContext.js
components/MyComponent.js
To solve my problem I did a singleton with this code:
And then in all the components that have a child that had
DragDropContext(HTML5Backend)
I remove it from those child and in their parents I do this:I think the key is that I only initialize
dnd
context once. What do you think?