Git Product home page Git Product logo

play-around-react-dnd's Introduction

Mini Project: Practice Drag & Drop with react-dnd

Date: 10 ~~>> 12 - Sep - 2020

Functions

  • Drag item from List and Drop to Container
  • Drag Item Around in Container
  • Study react-dnd
  • study useContext for state management
  • study redux toolkit for state management

Screenshot

practice-react-dnd

Tech-Stack

  • React Hooks
  • immutability-helper : Mutate a copy of data without changing the original source
  • react-dnd
  • react-redux
  • @reduxjs/toolkit

Plan Of Action

  • Read document of react-dnd
  • Initial Box component
  • useMemo for BoxStyle
  • Initial Container
  • Display box in Container
  • Drag box around in Container
  • Initial List component
  • useMemo for ListStyle
  • Drag item from List and Drop to Container
  • Display item currently dnd to Container
  • Read Document of immutability-helper
  • use immutability-helper to add newItem to boxes
  • check isDragBox and isDragList
  • useContext for state management : isDragBox, isDragList
  • Read Document of react-redux
  • Read Document of redux toolkit
  • update state management with Redux-toolkit
  • setBoxDragging
  • setListDragging
  • addItemBox
  • use immutability-helper to add newItem to boxItems
  • setNewLocationItem
  • use immutability-helper to update location of item in boxItems

Directory Structure

.
├── .gitignore
├── package.json
├── README.md
├── public
└── src
    ├── app
        └── store.js
    ├── components
        ├── Box.jsx
        ├── BoxSlice.js
        ├── Container.jsx
        ├── List.jsx
        └── index.jsx
    ├── App.js
    ├── ItemTypes.js
    └── index.js

Set up

Use the cmd line to clone repo to your computer

git clone [github_repo_url]

Use the cmd line to install dependencies.

npm install

Run in cmd for start the dependencies server

npm start

play-around-react-dnd's People

Contributors

tinspham209 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

rory-ferguson

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.