1

What is the best way to make a react-rendered DOM element draggable

  • without using external stuff like jQuery

  • with minimal code-footprint

  • with correct separation of view- and model-scope

So far this is the principal of my code (ES6, transpiled by babel.js in webpack):

View

export default React.createClass({

    isDragged(){
        console.log('what now?')  
    },

    render () {
        return(
            <div draggable='true' onDrag={this.isDragged}>
            </div>
        )
    }
})

Model

export default Model.extend({
    props: {
        x: 'number',
        y: 'number'
    }
})
hichris123
  • 10,145
  • 15
  • 56
  • 70
Benvorth
  • 7,416
  • 8
  • 49
  • 70
  • http://stackoverflow.com/questions/20926551/recommended-way-of-making-react-component-div-draggable – knowbody Jun 28 '15 at 13:10

1 Answers1

0

There is a great library called react-dnd that can help

http://gaearon.github.io/react-dnd/

Qiming
  • 1,664
  • 1
  • 14
  • 18