React Drag And Drop Tutorial - React-DND Made Simple

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ต.ค. 2024
  • Hey everyone, in this video I will go over the react-dnd library and create a simple application where you are able to use a drag and drop functionality.
    Code: github.com/mac...
    -
    ❤️ Want to Support the Channel?:
    / @pedrotechnologies
    🚀 Learn ReactJS By Building 6 Projects: codedamn.com/l...
    -
    Social
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    Website: machadopedro.com
    Linkedin: / machadop1407
    Instagram: / _pedro.machado_
    Github: github.com/mac...
    Email: machadop1407@gmail.com
    Tags:
    ReactJS Tutorial
    ReactJS and MySQL
    NodeJS Tutorial
    API Tutorial
    #react-dnd #draganddrop

ความคิดเห็น • 101

  • @fancyAlex1993
    @fancyAlex1993 2 ปีที่แล้ว +20

    Thank you very much for making this tutorial and not making it a living nightmare to follow. The authors of React Dnd should really take note on how to make a simple tutorial like this. Clean and precise! Not telling us on his thought process while making a tutorial.
    Example : "Why A8 instead of A1? To match the browser coordinate orientation. I tried it another way and it just messed with my head too much." This is from docs, something we don't really need to know. Moreover, in the docs , it goes into three different wrong ways before doing it the correct way. All we need is the correct working examples. Moreover, it was so hard to follow and not sure where was it taking us.

  • @svaibavbajra
    @svaibavbajra 2 ปีที่แล้ว +6

    Wanted to learn React DnD, saw his name, watched the video, totally worth it. This man is a fucking legend

  • @thecreepynation3599
    @thecreepynation3599 6 หลายเดือนก่อน +2

    The intro is too short. Can you make it like 80% of the actual video?

    • @PedroTechnologies
      @PedroTechnologies  6 หลายเดือนก่อน

      Sure i will do this next time :)

  • @FrodosBeutel
    @FrodosBeutel ปีที่แล้ว +3

    Finally a tutorial that doesn't explain stuff for 20 mins just to add 5 min drag and drop at the end

  • @mwnkt
    @mwnkt 3 ปีที่แล้ว +6

    it's like you were reading my mind. I was about to search for this and you did a video on it, thanks, keep up the good work.

    • @rabiaimran9027
      @rabiaimran9027 3 ปีที่แล้ว +2

      haha yes me too

    • @PedroTechnologies
      @PedroTechnologies  3 ปีที่แล้ว +2

      Hahaha I don't know why I decided to make this video! The idea just came to my mind!

    • @musmanathar3608
      @musmanathar3608 3 ปีที่แล้ว +1

      @@PedroTechnologies i was searching same work for the last three days
      and you came like a miracle, you helped me a lot, I need one more help, can we move div instead of pictures.please suggest me

  • @pegihr
    @pegihr 3 ปีที่แล้ว +9

    Hi pedro, it’s was a long time I haven’t watched your video. I've been busy working on several projects for the past few months. thanks for the videos so far. From your video I started to learn React. although furthermore I'm looking for other references, but your content is what makes me interested in React which my current project is mostly React.

    • @PedroTechnologies
      @PedroTechnologies  3 ปีที่แล้ว +2

      That is awesome! Always diversify your resources :) I am happy to hear I helped you learn!

    • @DeepakSharma-tr2ny
      @DeepakSharma-tr2ny ปีที่แล้ว

      @@PedroTechnologies Hello, How can we drag back the items from container to their initial position. for example we mistakenly drag some items then how can we drag back the same? please help

  • @nickkeller9314
    @nickkeller9314 2 ปีที่แล้ว +2

    Thanks, awesome content ;) But what if I need to drop my elements to a relative container, that keeps element's position wherever I dropped them? Can you give me an advise please?

  • @sanketgole4199
    @sanketgole4199 3 ปีที่แล้ว +3

    Make small project on nodejs mongoose reactjs product details uploaded

    • @PedroTechnologies
      @PedroTechnologies  3 ปีที่แล้ว

      It has been a while since I made a video using mongo, might do one :)

  • @romimaximus
    @romimaximus 3 ปีที่แล้ว +1

    This would be nice to do a App project management like Trello, and save to elements positions to a database, do you think you could a video tutorial example like that ?

  • @ol1175
    @ol1175 3 ปีที่แล้ว +2

    Thanks Pedro, would be really nice if u explain Redux.
    Looks so complicated:(
    Thanks for vids👍

    • @PedroTechnologies
      @PedroTechnologies  3 ปีที่แล้ว

      Hahaha I usually don't use Redux. However I had to learn it for my job so maybe I can make a video on it

  • @deniseleinonen6095
    @deniseleinonen6095 ปีที่แล้ว

    I put the DndProvider component in app.tsx and then when I started the app I got this error:
    ERROR in ./node_modules/react-dnd/dist/core/DndProvider.js 28:0-48
    Module not found: Error: Can't resolve 'react/jsx-runtime' in '...........app
    ode_modules
    eact-dnd\dist\core'
    Did you mean 'jsx-runtime.js'?
    BREAKING CHANGE: The request 'react/jsx-runtime' failed to resolve only because it was resolved as fully specified
    (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
    The extension in the request is mandatory for it to be fully specified.
    Add the extension to the request.
    Has anyone else got the same problem? And how did you managed to fix the problem? I'm working on react version 17

  • @asfnobambu
    @asfnobambu ปีที่แล้ว

    After the "npm i", the "npm start" did not run. So this is not working anymore...

  • @oliboucher6624
    @oliboucher6624 6 หลายเดือนก่อน

    I would like to be able to only drag an item once, we can actually drag an item that is in the board or not multiple time… how could I do it??

  • @utkarshsharma1185
    @utkarshsharma1185 ปีที่แล้ว +1

    Thanks pedro

  • @nabeelamer4525
    @nabeelamer4525 ปีที่แล้ว

    while droppping images are not getting dropped what could be the issue?

  • @gilgameshgaming4210
    @gilgameshgaming4210 2 ปีที่แล้ว

    Thank you for simplifying the library, hope you have wonderful day/evening

  • @blakef.8566
    @blakef.8566 2 ปีที่แล้ว +5

    Had a bit of trouble getting started from the docs. This is was incredibly helpful. Thanks!

  • @DIVYANSHMNIT
    @DIVYANSHMNIT ปีที่แล้ว +1

    Great efforts man. You nailed it!

  • @shahidrizwan6903
    @shahidrizwan6903 3 ปีที่แล้ว +3

    Your videos make me love ReactJs more. Keep up the good work, Pedro.

  • @gonzalolezodecordova9825
    @gonzalolezodecordova9825 ปีที่แล้ว

    Hi Pedro. That was GREAT!! Could you male a tutorial with this same DND for the following case including a clickon so that when I click on the image once on the dropped area, it returns to its original place? For example: I have three boxes: Box 1: My, Box 2: Name and box 3 : is Carlos. But they are in an unordered manner and I want my student to drag and drop them on the dropping area correctly. In addition, I want to move them around in the dropping area and also to make any of them return to the original area when I click on them. THX!!!

  • @hamidrezanaji9253
    @hamidrezanaji9253 ปีที่แล้ว

    what if I have 2 boards ? How can i do it which board has been chosen?

  • @rooneyjohn
    @rooneyjohn ปีที่แล้ว

    I love no-nonsense tutorials! I couldn't agree more with Alex Fancy.... just the fact please! (it's why I subscribed to your channel... keep up the no bullshit tutorials!)

  • @erentr7167
    @erentr7167 2 ปีที่แล้ว +2

    Thank you for a great tutorial! there wasnt enough documentation for dnd and this video really helped me alot!

  • @AdamsApples46
    @AdamsApples46 3 ปีที่แล้ว +2

    yo PT, thanks for the clear and concise explanation on the basics of react dnd

  • @yegorm3029
    @yegorm3029 2 ปีที่แล้ว +1

    Thanks for the great tutorial! It helped me greatly with the implementation of dnd in my React learning project!

  • @anoop7133
    @anoop7133 ปีที่แล้ว

    Thanks alot for this wonderful video of DnD .. As u mentioned in the video, I couldn't understand it properly at first. But the way u explained was so great and it will be more helpful when u watch it two or three times. Keep going brother....

  • @Todiros
    @Todiros ปีที่แล้ว

    How do I get data from the drop container? I have a bunch and I need to know exactly which one I'm dropping at. I can only get the 'id' of the element being dragged but not on the drop target.

  • @jittojoyes7533
    @jittojoyes7533 ปีที่แล้ว

    Can you do more videos on this also for beautiful dnd

  • @chesswithben832
    @chesswithben832 ปีที่แล้ว

    Hi i have a question about using drag and drop for my chess game just wondering if you could send me down the right track of what to do , the chess pieces move back to there original spot once moved and are then updated to the new spot, i want to drop them in the square and leave them their , easier explained in the video th-cam.com/video/7lpWt3hM0AQ/w-d-xo.html

  • @michaelrooze278
    @michaelrooze278 2 ปีที่แล้ว

    I am trying to drop items on to a mapped grid but I don't know how to let it know which square I am dropping to. Any ideas?

  • @artem.matseruk
    @artem.matseruk 3 ปีที่แล้ว +1

    Pedro, your video was very useful, thanks for the tutorial, and good luck =)

  • @NeoCoding
    @NeoCoding ปีที่แล้ว

    tnx. don't like that, too complicated

  • @sercanyildirimtugcann
    @sercanyildirimtugcann 2 ปีที่แล้ว

    Is there anything in DND to create my own emoji rating people can drag and drop on the form easily? Can I do that easily?

  • @kokilanadar486
    @kokilanadar486 2 ปีที่แล้ว

    this video was really useful! ❤ but could you help me? i wanted to drop the same image multiple times onto the board,, what should I do?

  • @millery9405
    @millery9405 ปีที่แล้ว

    It's quiet useful tutorial for beginners. Thank you for the video buddy!

  • @benzz22126
    @benzz22126 2 ปีที่แล้ว

    hi this was the best explanation for the dnd module. is there a way to persist that newly sorted array in mongodb? I have a todolist and i want it to be dnd...but as soon as i restart my page...my order is reset to default.

  • @S--xc4rv
    @S--xc4rv ปีที่แล้ว

    is there any video of your on beautifil-dnd

  • @davidwang7206
    @davidwang7206 3 ปีที่แล้ว

    Hey Pedro, do you know why dropping is not working on Firefox (but works perfectly on Chrome/Safari) ? The image appears in the middle of the screen and the server does not work anymore :(

  • @coronelkurtz
    @coronelkurtz 3 ปีที่แล้ว +1

    Hi Pedro I love ur content my dude, you pulled me again into coding. I have one question: How can I make separated Css files for each page? Right now I have homepage with "register" page styles too. is there any solution? Thanks!!

    • @PedroTechnologies
      @PedroTechnologies  3 ปีที่แล้ว

      That makes me happy! You can create separate css files and just import them inside of the page component you want. Ex: inside of the home page component you can do somehing like import './Home.css'

    • @mwnkt
      @mwnkt 3 ปีที่แล้ว

      Using SCSS is amazing , you could just give the main div being rendered a className and the only style items inside that div. The styles shouldn't be used in any other file like that. If it helps.

  • @musmanathar3608
    @musmanathar3608 3 ปีที่แล้ว

    hy there, thanks for this , i need same code for a drag and drop of div in another div, what will be the changes?
    please suggest me

  • @MoathElmarmori
    @MoathElmarmori ปีที่แล้ว

    You are a legend, thank you so much

  • @pjcodes438
    @pjcodes438 3 ปีที่แล้ว +1

    Your explanation was simply awesome man, keep up the good work :)

  • @marwa_als
    @marwa_als ปีที่แล้ว

    Can I use this way now , or it have a new way

  • @cristianhoger
    @cristianhoger 2 ปีที่แล้ว

    thanks for the video, finally I could implement a working drag and drop

  • @zloi_mishka
    @zloi_mishka 9 หลายเดือนก่อน

    U get {isDragging} but didn’t use

  • @seifhorrigue2977
    @seifhorrigue2977 2 ปีที่แล้ว

    hey pedro thanks for the video it was amazing , i wan't to ask you how can i keep the place of the dropped image in the right place i wan't it to be on the board ?

  • @holycrocs3670
    @holycrocs3670 ปีที่แล้ว +1

    your tutorials are so helpful, thank you for making them!

  • @mateusgoulart3120
    @mateusgoulart3120 5 หลายเดือนก่อน

    Thanks brother, youre the best!!

  • @yashsinha2872
    @yashsinha2872 2 ปีที่แล้ว

    Hii
    Can we get the coordinates of x and y axis as well for the image drop in any position of that div???

  • @SarathChandran96
    @SarathChandran96 2 ปีที่แล้ว

    Thank you so much brother. Really helped me . I was given a tough task in my company . This really helped me.

  • @ZhangYangbiao
    @ZhangYangbiao ปีที่แล้ว

    thanks for your effort in this tutorial, it's very helpful to understand dnd!

  • @shovanmazumder1013
    @shovanmazumder1013 2 ปีที่แล้ว

    Please show how to remove the item from list after dropping

  • @alexmir9878
    @alexmir9878 ปีที่แล้ว

    Thank you for it, without you the topic was scary and I could not do it for a week 🙏

  • @Chris-rw3rz
    @Chris-rw3rz 3 ปีที่แล้ว

    Pedro, your video was very useful. have a nice day :)

  • @carinwood1206
    @carinwood1206 ปีที่แล้ว

    Best tutorial on Dnd that I've found on TH-cam.

  • @weijunhuang8306
    @weijunhuang8306 2 ปีที่แล้ว

    very useful video, the concept is pretty clearing

  • @_carlaque
    @_carlaque 2 ปีที่แล้ว +1

    excelente video!!! parabens e valeu pelo conteudo massa, tem me ajudado muito no desenvolvimetno do meu tcc

  • @_hugo_cruz
    @_hugo_cruz ปีที่แล้ว

    Great bro!!! Thanks a lot!!

  • @tamarlola
    @tamarlola ปีที่แล้ว

    Professional and good tutorial !
    I would appreciate it if you could upload a guide that explains how the user can change the order of the images after they have been uploaded to the drag area.

  • @billynitrus
    @billynitrus ปีที่แล้ว

    Very good tutorial, efficient, engaging, and well explained

  • @abonoah-3495
    @abonoah-3495 2 ปีที่แล้ว

    Thanks a lot, you have survived me with this awesome video!

  • @omerfaran8514
    @omerfaran8514 2 ปีที่แล้ว

    Hey Pedro I think they probably changed stuff in their library because now when dragging the image, it shows a cursor of "forbidden" and if you drop it outside of the left container it won't do an animation of the image going back to its original place...This is at least for me in Chrome

  • @MJstart
    @MJstart ปีที่แล้ว

    Thank you so much man

  • @gianguyenngo4176
    @gianguyenngo4176 2 ปีที่แล้ว

    Your explaination is better than Dnd docs. You save my day. Thank you =)

  • @dravidmrdj5156
    @dravidmrdj5156 ปีที่แล้ว

    Thank you bro!

  •  2 ปีที่แล้ว

    Thanks! It was simple enough

  • @DiegoWahl
    @DiegoWahl ปีที่แล้ว

    bom video 👍

  • @muhammad_abir
    @muhammad_abir ปีที่แล้ว

    thanks bro

  • @osmansagsoz9701
    @osmansagsoz9701 2 ปีที่แล้ว

    thank you! this helped a lot.

  • @mickafilms
    @mickafilms ปีที่แล้ว

    sa e ke?

  • @duajan8651
    @duajan8651 2 ปีที่แล้ว

    that was a really really good tutorial

  • @lucienchu9649
    @lucienchu9649 2 ปีที่แล้ว

    Good intro already, thanks

  • @ThColinPereira
    @ThColinPereira 3 ปีที่แล้ว

    whoa this is an absolute banger

  • @shubhamsnehi5890
    @shubhamsnehi5890 2 ปีที่แล้ว

    This video helped me a lot!

  • @hishamahammmedkm1936
    @hishamahammmedkm1936 3 ปีที่แล้ว

    iam happy to see you

  • @zyzhangsiyuan7292
    @zyzhangsiyuan7292 2 ปีที่แล้ว

    thanks I learned a lot

  • @gregoryzhang743
    @gregoryzhang743 3 ปีที่แล้ว

    Very nice one, thanks

  • @saidmaroc8448
    @saidmaroc8448 3 ปีที่แล้ว

    difficult for me, but well explained, thank you

    • @PedroTechnologies
      @PedroTechnologies  3 ปีที่แล้ว +1

      It is a complicated library, glad you liked it :)

  • @Декопитатор321
    @Декопитатор321 2 ปีที่แล้ว

    thanks a lot bro))

  • @tanyanagi9561
    @tanyanagi9561 2 ปีที่แล้ว

    It is amazing one

  • @fahmifirmansyah3857
    @fahmifirmansyah3857 2 ปีที่แล้ว

    Thank you sir

  • @travel_worldwide_365
    @travel_worldwide_365 3 ปีที่แล้ว

    Nice explanation.

  • @thedevhacker4608
    @thedevhacker4608 3 ปีที่แล้ว

    Love you dude

  • @حسیننهالی-و7ق
    @حسیننهالی-و7ق 2 ปีที่แล้ว

    very good

  • @lickybuay
    @lickybuay ปีที่แล้ว

    Really nice tutorial.. with React-DND you can drag drop text and put in a cursor position inside a editable div/element?

  • @offthecliffwithshizzy4944
    @offthecliffwithshizzy4944 2 ปีที่แล้ว

    ERROR in ./node_modules/react-dnd/dist/core/DndProvider.js
    i get this error and i am using react 17.0.2