Last active
August 29, 2015 14:25
-
-
Save Killavus/c1b13026902b28fba19b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react/addons'; | |
import { DragDropContext, DragSource } from 'react-dnd'; | |
import HTML5Backend from 'react-dnd/modules/backends/HTML5'; | |
@DragDropContext(HTML5Backend) | |
class App extends React.Component { | |
render() { | |
return( | |
<div> | |
{this.props.children} | |
</div> | |
); | |
} | |
} | |
const FooSource = { | |
beginDrag() { return {}; } | |
}; | |
function collectFooSource(connect) { | |
return { | |
connectAsDragSource: connect.dragSource() | |
}; | |
} | |
@DragSource("foo", FooSource, collectFooSource) | |
class Foo extends React.Component { | |
render() { | |
let { connectAsDragSource } = this.props; | |
return connectAsDragSource(<p>Test!</p>); | |
} | |
} | |
React.render(<App><Foo key='1' /><Foo key='2' /></App>, document.body); // Error! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment