Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sample code not working #22

Closed
vgurnani-systango opened this issue May 9, 2017 · 3 comments
Closed

sample code not working #22

vgurnani-systango opened this issue May 9, 2017 · 3 comments

Comments

@vgurnani-systango
Copy link

vgurnani-systango commented May 9, 2017

I have copied the source code provided by you guys in documentation but getting error

import { Draggable, Droppable } from 'react-drag-and-drop'

class App extends React.Component {
    render() {
        <div>
            <ul>
                <Draggable type="fruit" data="banana"><li>Banana</li></Draggable>
                <Draggable type="fruit" data="apple"><li>Apple</li></Draggable>
                <Draggable type="metal" data="silver"><li>Silver</li></Draggable>
            </ul>
            <Droppable
                types={['fruit']} // <= allowed drop types
                onDrop={this.onDrop.bind(this)}>
                <ul className="Smoothie"></ul>
            </Droppable>
        </div>
    }
    onDrop(data) {
        console.log(data)
        // => banana 
    }
}

ERROR-
A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object. + react-drag and drop

Any help would be great.
Thanks for making this and any help in advance.

@azz0r
Copy link

azz0r commented May 9, 2017

Export default class App?

@vgurnani-systango
Copy link
Author

Thanks for the reply but I am exporting the class like-

export default App

@asbjornenge
Copy link
Owner

@vgurnani-systango This is more of React error than specific to this package, so try google the error message or check stackoverflow 😄👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants