[Question] Drag item must be a plain object - why?
See original GitHub issueWhy does react-dnd require the drag item to be a plain object? I’m currently wrapping things like class instances in arbitrary objects, e.g.
return {
value: new MyDragItem(...)
};
… to get around this, but I’d like to understand why it’s there in the first place.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Error: First argument to `createDraft` must be a plain object, an ...
Immer lets you use an imperative API and should be modifying the value like this state.count += 1 , not returning a new...
Read more >How To Create Drag and Drop Elements with Vanilla ...
In this tutorial, we will build a drag-and-drop example using the HTML Drag and Drop API with vanilla JavaScript to use the event...
Read more >An Essential Guide to JavaScript Drag and Drop By Examples
This tutorial introduces you to the JavaScript Drag and Drop API and shows you how to handle drag and drop events effectively.
Read more >HTML Drag and Drop API - MDN Web Docs
DataTransfer objects also have methods to add or remove items to the drag's data. The DragEvent and DataTransfer interfaces should be the only ......
Read more >JavaScript Drag and Drop With Backend Interactivity
Most of this function is just creating a <p> element for each task, giving it text and a bunch of attributes, and putting...
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
Thanks for your reply.
That seems incredibly limiting to me. Beyond the scenario raised in this issue - i.e. using class instances - I’ve also used plain drag objects which just happen to include functions that the drop target can call. I highly doubt I’m the only one.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.