2 ms·
So I'm curious how one would implement something like drag and drop in a React app? Would you model the drag in the main data model somehow? Or would you do th
by __david__ 12y ago
So I'm curious how one would implement something like drag and drop in a React app?
Would you model the drag in the main data model somehow? Or would you do that all externally (with traditional DOM manipulation) and then update the model when the drag is complete?
- cnp 12y agoThe latter. You would use html5's draggable, then update on complete. Check out http://webcloud.se/sortable-list-component-react-js/ http://webcloud.se/sortable-list-component-react-js/
- dugmartin 12y agoI wouldn't use the DOM. To "embrace" React you really need to forgot the real DOM exists and instead track the drag in the components state and handle moving the items around in the render function.