Can a single component be also a DragSource as well as DropTarget
See original GitHub issueI believe a single component can be a DragSource as well as a DropTarget. I am doing a sortable <Layer>
component sort of like your <Card>
example. My question is how do I do both without using ES7?
In your <Card>
example, you have
@DropTarget(ItemTypes.CARD, cardTarget, connect => ({
connectDropTarget: connect.dropTarget(),
}))
@DragSource(ItemTypes.CARD, cardSource, (connect, monitor) => ({
connectDragSource: connect.dragSource(),
isDragging: monitor.isDragging()
}))
export default class Card {
}
But I want to only use ES6, so how do I combine both DragSource and DropTarget in here:
class Layer extends Component {
}
// Where to put the DropTarget??
export default DragSource('layer', layerSource, collect)(Layer);
Is it I have to use _.flow()
from lodash?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:7
- Comments:8 (3 by maintainers)
Top Results From Across the Web
React DnD - GitHub Pages
How do I register a drag source or a drop target when the type depends on ... How do I combine several drag...
Read more >Drag and Drop in React. Using react-dnd | by Sean LaFlam
A drag source is the draggable component. It's job is to carry the relevant info needed to perform some action to the drop...
Read more >Implementing Drag and Drop - SurviveJS
In this chapter, we will integrate drag and drop functionality to it as ... import {compose} from 'redux'; import {DragSource, DropTarget} from 'react-dnd';....
Read more >How to get setup with React DnD - codeburst
In this way you can add multiple components with DragSources to your ... our DragSource Spec, we could use also use drop() in...
Read more >Drag and Drop Subsystem for the Java 2 Platform Standard ...
Component additions for DropTarget (de)registration; 2.4.2 The DropTarget ... A DragSource shall only permit a single drag and drop operation to be current...
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
Good point. I’d say accessing instance is usually an anti-pattern. Why do you need it?
Anyway, you can access the “original” component by
component.getDecoratedComponentInstance()
.@jawb
Check out
Card
insortable-simple
.