Skip to main content

One post tagged with "react"

react articles

View All Tags

Drag and drop from scratch with React

· 5 min read
Aaron wolf
Lead writer and developer

Intro

In this tutorial I will show how to make a Drag and Drop component from scratch with no 3rd party libraries using React.

Important info

  1. There exists the event handler e.dataTransfer which helps with drag and drop functionality, but as we're using React I find using state to be simpler.

  2. Make sure to check out the Code Sandbox. I may add a few things that aren't reflected below, but the code below is complete.

  3. You might know a better way to do this! If you think you can improve the code please comment.