Overview
This is my work for the official react-dnd tutorial
It consists of a chess board with a single knight piece. You can drag and drop the knight per the rules of chess with validations.
My code is highly annotated to reflect my understanding of the key library components, as of the react-dnd
version set in yarn.lock
.
If interested take a look at:
- src/chess/board_square.jsx (the DropTarget);
- src/chess/knight.jsx (the DragSource)
- src/chess/board.jsx (the DragDropContext)
The working code is deployed to https://cocky-lamarr-91e87a.netlify.com/.
To run locally
npm install -g gatsby-cli
if Gatsby is not installedgit clone git@github.com:Adam262/react-dnd-chess-tutorial.git
cd
into project directoryyarn install
gatsby develop
You can see the local site at localhost:8000