Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

yes, this is a good question. I still have to implement drag and drop in a react project, and it seems the way to go is do this all through state? Which means none of the existing drag and drop solutions will work (any DOM manipulation without react knowing about it will cause trouble), and since react is relatively new there is seems there is still a need for good reusable animation components/mixins, and in the mean time, it's all a bit more manual work.


> Which means none of the existing drag and drop solutions will work (any DOM manipulation without react knowing about it will cause trouble)

Um, we totally use jquery-ui's drag and drop in a React component in production and nothing bad happens.


Ah, ok. Good to know. You just listen to the drop events and then update the state of react?


Yup, but it's not necessarily UI state that gets updated, just something that maps draggables to where they've been dropped.


yes, like updating the position in a sorted list you mean right. And did you also get it to work with touch events on mobile? I have an open question about that on SO http://stackoverflow.com/questions/27837500/drag-and-drop-wi...


Simply adding jquery-ui.touch-punch[0] monkey patched jquery-ui without us having to do anything else.

[0]: http://touchpunch.furf.com/


On over/drop you update your state and the view updates as appropriate yeah. Presumably some css transitions could make it pretty, I just went with straight updates as in my case it was only for personal use.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: