question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Drag item must be a plain object - why?

See original GitHub issue

Why 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:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jamiewindercommented, Jul 16, 2018

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.

0reactions
stale[bot]commented, Jul 6, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found