A New Drag And Drop Library For EVERY Framework

  Рет қаралды 173,300

Theo - t3․gg

Theo - t3․gg

Күн бұрын

Пікірлер: 162
@WhatsuppFudd
@WhatsuppFudd 3 ай бұрын
This video is great for 2 reasons: it shows a neat pain-killer for drag-and-drop, and it showcases that no matter the additional tech, it's a major pain in the lower back to figure out what the React code will effectively do at runtime 🤓
@AndrewTSq
@AndrewTSq 3 ай бұрын
the problem I had, that I had to insert a timeout functionality when using the ondragstart, otherwise things would bug out completely :)
@Hacking-Kitten
@Hacking-Kitten 3 ай бұрын
1. "This has a bug let me show you" 2. "The bug actually is not here" 3. "This is still clearly the fault of the author, since the example is misleading" 4. "But here is a bug" 5. "Interesting" Listen, it is pretty clear the author of the example is no react dev, still the attitude is really a problem. "Damn I was wrong, learned something new" is a lot nicer than the other person always being at fault
@98f5
@98f5 2 ай бұрын
🎉🎉 this
@GreatTaiwan
@GreatTaiwan Ай бұрын
how will he know he was wrong ? he's just thinking out loud
@badumtsy
@badumtsy 3 ай бұрын
So glad to see more and more tools gradually supporting SolidJS!
@untlsn
@untlsn 3 ай бұрын
With Solid and Svelte you just need to expose native JS bindings and it will work
@jyjyjyj3
@jyjyjyj3 3 ай бұрын
@@untlsn Not many tools support native bindings these days. Most of them only work with react
@Dipj01
@Dipj01 3 ай бұрын
Solid is the goat
@TheAxeForgetsTheTreeRemembers
@TheAxeForgetsTheTreeRemembers 3 ай бұрын
@@untlsn I believe that was the intended joke ;-)
@Lemmy4555
@Lemmy4555 3 ай бұрын
It's normal that it doesn't rerender and it doesn't break, because even if you move a dom element, as long as the istance is the same it will work. This is the same way portals work. What you don't have to do is cloneElement and delete the original one, in that case react will break. Using key "breaks" it because react will take each element and destroy them, and create a new instance in the DOM. What should be clear to people is that what you have into JSX doesn't necessarily match with the actual DOM, JSX it's only a set of instructions that tell react what elements you have and what's their initial position, but you can move whatever you want with a js script. Potentially you can even remove an element from the root document but keep it in memory, react will still track it.
@IbrahimAbdallah-s5e
@IbrahimAbdallah-s5e 3 ай бұрын
There's pragmatic-drag-and-drop from atlasian now
@HemstitchedIrony
@HemstitchedIrony 3 ай бұрын
Drag and drop is one of those things that seems like it should be relatively simple, then you try to do basically anything with it and realize how unbelievably complex it gets so quickly
@sydviera
@sydviera 3 ай бұрын
Funnily enough with the auto animate mention, formkit also have their own drag and drop library that's really easy to implement
@TheAlexLichter
@TheAlexLichter 3 ай бұрын
My thoughts exactly! Also framework-agnostic
@sunny8k
@sunny8k 3 ай бұрын
Angular CDK had the best drag and drop I've seen, and it's relatively light on it's own
@helleye311
@helleye311 3 ай бұрын
It's great that this works for vanilla js. Though for react, the formkit drag and drop seems much better. Barely any setup, just give it a list and plug in the ref for basic functionality. dndkit is fine as well, but it's definitely a lot more manual if you want to keep state synced from what i remember from using it. Anything is better than beautiful dnd though.
@stevenhorton8604
@stevenhorton8604 3 ай бұрын
Uncommonly great video quality. I feel like this will get less views than other stuff, but more people will come back to this video and use the information. A+++ SUPER FAST SHIPPING && SUPER CLEAN
@CristianKirk
@CristianKirk 3 ай бұрын
Very nice library! And it's worth mentioning that it works with pure js even if most developers can't build shit without a framework.
@dave6012
@dave6012 3 ай бұрын
That was pretty impressive the way you were able to find a way to sprinkle a ton of salt into that compliment.
@YashShah-ml9pg
@YashShah-ml9pg 3 ай бұрын
You can force a subtree to reset its state by giving it a different key. This is react behavior and not an edge case.
@StemLG
@StemLG 3 ай бұрын
Love these kinds of videos, introducing us to new technologies, makes being up to date and more efficient a lot easier. Thanks theo
@LearnPayload
@LearnPayload 3 ай бұрын
Pragmatic Drag-n-Drop (by Atlassian) is also very good - framework agnostic
@invisibilities
@invisibilities 3 ай бұрын
10:51 look at how happy he looks after breaking it successfully
@ytlongbeach
@ytlongbeach 3 ай бұрын
@theo - I totally wanted a video on this subject. Excellent job. Thx !!!
@Atmos41
@Atmos41 3 ай бұрын
I love how confused Theo is about the example working so well
@MarlonEnglemam
@MarlonEnglemam 3 ай бұрын
I love auto animate, I’ve used it in pretty much all of the react apps I’ve worked on, it just gives the right amount of animation needed, not too fancy, just the needed! ❤
@SpektRProduction
@SpektRProduction 3 ай бұрын
Atlassian pragmatic drag and drop
@yannick7049
@yannick7049 3 ай бұрын
dnd-kit, sadly, seems to be a dying project. Not much movement is happening on it.
@wshewm
@wshewm 3 ай бұрын
The docs are just so rough man. A docs overhaul could save the project
@SharkFaceKilla
@SharkFaceKilla 3 ай бұрын
Just used it for my own project and man it was annoying
@dealloc
@dealloc 3 ай бұрын
To be honest, I've felt like DndKIt hasn't really been ready for production since it's early "beta" release, compared to react-beautiful-dnd. It seems to lack a ton of features and edge-cases.
@timthndr2996
@timthndr2996 3 ай бұрын
Good to know I wasn't the only one that felt that way. It felt like I was running into edge case after edge case, which could have been solved with two lines of documentation.
@rajneeshmishra6969
@rajneeshmishra6969 3 ай бұрын
You mean not much dragging coz the team is on DND?
@Exilum
@Exilum 3 ай бұрын
Honestly I doubt anyone would run into those edge cases you speak of. More than edge cases, this was default react behavior. It's the same with portals. If you re-render the parent of the portals, of course the portals will re-render. What you want is external state to be unrelated to swapy so the container itself never re-renders with a different key, and then it's just fine to have state anywhere else. The only time swapy broke was when you changed the key, so react thought the container was an entirely new div.
@aramp
@aramp 3 ай бұрын
2:00 Svelte has this natively, with one line of code
@Naparajith
@Naparajith 3 ай бұрын
It's insane clicking on Theo's videos with DeArrow enabled.
@tuxhome3686
@tuxhome3686 3 ай бұрын
Lmao honestly. Someone has it out for him
@fantasypvp
@fantasypvp 3 ай бұрын
0:15 I had to manually implement drag and drop for a custom widget using pyqt5 for a coursework project once. it took 10 hours to write the 50 lines of code needed to make it work.
@lynxcat4life
@lynxcat4life 3 ай бұрын
TAKE A SHOT ITS NEW JAVASCRIPT LIBRARY DAY
@cyrus01337
@cyrus01337 3 ай бұрын
This is normal in every ecosystem with a package registry though...
@HarrisonGould
@HarrisonGould 3 ай бұрын
@@cyrus01337all I’m hearing is more shots
@anashameed9159
@anashameed9159 3 ай бұрын
7:29 theo relising the theoretical complex solutions he build in twitch is in this library 😂
@petemoss3160
@petemoss3160 3 ай бұрын
loving the tendency for front-end libraries to use HTML attributes!
@ray73864
@ray73864 3 ай бұрын
jQuery UI had draggable over a decade ago :) Was super easy to use when I used it about 10yrs ago.
@sahilverma_dev
@sahilverma_dev 3 ай бұрын
I am exploring drag and drop and use used dnd kit and I am currently exploring Atlassian's pragmatic drag and drop. I might also try this.
@salvehn
@salvehn 3 ай бұрын
any good modern alternatives for react-grid-layout?
@osamashaikh8480
@osamashaikh8480 3 ай бұрын
react-grid-layout, muuri are pretty good
@JustinSBarrett
@JustinSBarrett 2 ай бұрын
I'm curious to hear your thoughts on the Pragmatic drag and drop from Atlassian. I'm just investigating it now, and while it takes a bit more to set up, I like how it's applicable to a lot of different DnD situations.
@Remiwi-bp6nw
@Remiwi-bp6nw 3 ай бұрын
drag and drop is actually crazy hard
@i-bangash
@i-bangash 3 ай бұрын
Theo breaking code is the content I didn't know I needed. I could watch that for hours!
@iamTLC
@iamTLC 3 ай бұрын
I need this for table rows!!!! :( dnd kit will rerender sooooo much
@kobibr9362
@kobibr9362 3 ай бұрын
This morning I found out about something I have never noticed on Firefox before. I had a a hidden checkbox input with default value to checkbox. When you change the value and refresh the page, Firefox update everything on the page but does not change the last value of that input. I cant find any cache/local storage ref to the value. It just does it somehow. It doesn't on chrome. I am not using any lib or framework by the way or cache mechanisms.
@davr1
@davr1 3 ай бұрын
Try setting the autocomplete property to off on that checkbox
@dealloc
@dealloc 3 ай бұрын
Although react-beautiful-dnd is no longer actively maintained other than bug fixes, it is still the most complete solution to this day. Even Linear uses it-it's still not _perfect_, but having tried a ton of other solutions, I can hardly recommend anything else really. Not even DndKit.
@gadgetboyplaysmc
@gadgetboyplaysmc 3 ай бұрын
Definitely check out pragmatic-drag-and-drop. Some Atlassian oss as well. (same org that made react-beautiful-dnd, and Jira lol).
@tthiagolino8
@tthiagolino8 3 ай бұрын
"Can't handle react renders' edge cases well" So it will work fine with all other frameworks So the problem is not the library, it's React's re-rendering model
@noah.correa
@noah.correa 3 ай бұрын
Shall we introduce you to the Angular CDK Drag & Drop? It's awesome and easy to use
@ethanp.8025
@ethanp.8025 3 ай бұрын
out of curiosity, when you found the problem/edge case with having a global state which updated causing any changes made to be reset - would having it stored in localStorage (as the example had) have prevented this? my thoughts being that the re-render would then fetch where things should be from localStorage or wherever and then rendered using that. (im still a somewhat react noob)
@crackedboy701
@crackedboy701 3 ай бұрын
wow this video made me subscribe, i dont do that so great video
@freecourseplatformenglish2829
@freecourseplatformenglish2829 3 ай бұрын
I think dockview is the same library that Leetcode uses for there drag and drop layout with tabs.
@mdemdemde
@mdemdemde 3 ай бұрын
Which editor is he using that has a navigator included??
@zocky3282
@zocky3282 3 ай бұрын
Stackblitz
@Arknaes54
@Arknaes54 Ай бұрын
I can't seem to find any support or community for this library anywhere but here? I am currently implementing it in a POC. It's a Next 15 project with shadcn and tailwind. I tried to make the "React Dynamic" example from their github and i can't see to make it work at all. It breaks already from the get go with "Cannot create a Swapy instance because your HTML structure is invalid." - And then it is pointing to this: swapyRef.current = createSwapy(container, { manualSwap: true, swapMode: "hover", autoScrollOnDrag: true, }); Anyone know what i am doing wrong??
@Arknaes54
@Arknaes54 Ай бұрын
btw, i have this line right above the function that fails: const container = document.querySelector(".container")!; -idk what the exclamation mark is all about, but it is in both examples i have found :s
@shrewd7795
@shrewd7795 3 ай бұрын
Dnd kit with framer motion is still the best.
@crugg
@crugg 3 ай бұрын
I wonder if this can be combined with PaneForge (Svelte), because that would be extremely powerful...
@jakemetz7035
@jakemetz7035 3 ай бұрын
Looks awesome. Are the drop slots predefined sizes? IE when I drag one item to the next can it retain it's item size and not the new drag slot size
@TesttroisProjet
@TesttroisProjet Күн бұрын
dnd kit has a bug with the sortable element when height of each element have different height
@sami616
@sami616 3 ай бұрын
Pragmatic Drag and drop is 🔥🔥
@nisabmohd
@nisabmohd 3 ай бұрын
For some time I was getting the feeling that I don't understand react re-render 😂
@alexandermercer5363
@alexandermercer5363 3 ай бұрын
Welcome to today's episode of, Theo tries to break a library!
@HiImKyle
@HiImKyle 3 ай бұрын
Right as a needed to look up how to do this sort of stuff
@anotherelvis
@anotherelvis 3 ай бұрын
How often do you need this exact feature? I cannot think of a use case... But it sure is pretty
@maxziebell4013
@maxziebell4013 3 ай бұрын
I was also playing around with it in July. Then it still had problems with absolute positioning. Hope that gets resolved.
@Kaze919
@Kaze919 3 ай бұрын
Cries in react native. Having to use gesture handler and reanimated
@archmad
@archmad 3 ай бұрын
Dnd seems working well
@풍월상신
@풍월상신 3 ай бұрын
AutoAnimate from Vue Formkit is a good to know for me. Thanks...
@jaqvaneeden7890
@jaqvaneeden7890 3 ай бұрын
anybody know how this can work with angular v14 or some similar library compatible with v14
@griffadev
@griffadev 3 ай бұрын
the lack of attempt at making this accessible in their examples is a no from me
@TsillALevi
@TsillALevi 3 ай бұрын
Why I didn't know these sooner. 😂😂😂
@StaleDegree
@StaleDegree 3 ай бұрын
The reason the App doesn’t rerender is because there is no state update. There are dom events happening that switch the placements of the boxes but react isn’t aware of the changes because there is no set state function being called
@plastikbeau3695
@plastikbeau3695 3 ай бұрын
I thought it was going to be a demo of the LIBRARY, instead we got a dude trying to break react, which btw, is so unnecessary for this example anyways...
@shinnxzz
@shinnxzz 3 ай бұрын
Is it better / easier to work with Swappy over dnd kit?
@AndrewTSq
@AndrewTSq 3 ай бұрын
drag and drop complex? Not sure if I agree, but it could be hard to implement.
@Techguru604
@Techguru604 3 ай бұрын
Where is this? Is the park private?
@yathink2406
@yathink2406 3 ай бұрын
May be it is working in react future react 20😂
@scrapycholo2659
@scrapycholo2659 3 ай бұрын
Pragmatic DND ❤
@frosty129
@frosty129 3 ай бұрын
No drag animation == no go. Dead on arrival.
@isaidstream4547
@isaidstream4547 3 ай бұрын
why threre are no UI libraries for javascript?
@lienmeat
@lienmeat 3 ай бұрын
gosh it's almost like I used to do all this stuff in jQuery in a few lines of coffee ages ago... lol
@pranupranav5563
@pranupranav5563 3 ай бұрын
Dude setCount((v)=>v+1) is correct usage
@sahiljain5979
@sahiljain5979 Ай бұрын
can it drag drop multiple divs ?
@timseguine2
@timseguine2 3 ай бұрын
I also spent a lot of time dealing with drag and drop. That's why I get so angry using websites that do it badly.
@clashcon11
@clashcon11 Ай бұрын
I'm looking for react-native, but seems none here.
@ekalash
@ekalash 3 ай бұрын
Damn, all that shows me how backwards React actually is compared to the automatic reactivity system in Vue 3, you never run into mess like this, rather than spending time fixing re-renders you focus on business logic instead, amazed at how good Vue is compared to this, everyone should try it.
@brennan123
@brennan123 3 ай бұрын
Haven't played with the library but just watching it looks like changes to the JSX / VDOM break it? Maybe that's why they are using the localStorage on re-render as a workaround? You commented out that part so I wonder if it works again if you put the localStorage caching back in.
@ayoubaabass765
@ayoubaabass765 3 ай бұрын
YES! YES PLEASE
@theairaccumulator7144
@theairaccumulator7144 3 ай бұрын
bruh drag and drop is legit the worst problem I spent months trying to implement it in my custom UI framework I made for fun, it required a rewrite of half the framework and the code was still supremely cursed
@madmaxdev
@madmaxdev 3 ай бұрын
Time for shadcn to hop on
@TomNook.
@TomNook. 3 ай бұрын
I have a great time with DnD every weekend with my friends
@madmanali93
@madmanali93 3 ай бұрын
you know react aria has a pretty good drag and drop as well
@madmanali93
@madmanali93 3 ай бұрын
@MrSprinkles1F369 Ah ok cool they seem to be a bit different. my use case though react aria did a good job and was very simple to use . being buolt for react is a positive when its a react app.
@jasonrooney1368
@jasonrooney1368 3 ай бұрын
Why doesn’t React address the issue of using a vanilla JS library? Every other framework under the sun makes it trivial to wrap any vanilla JS library.
@powerclan1910
@powerclan1910 3 ай бұрын
i don't get how react up to this day is so fragile. I don't see the benefit of it over the vue ecosystem where everything just works. including islands
@dealloc
@dealloc 3 ай бұрын
Nothing in this video provide React to be "fragile". The simple explanation here is that if you update the DOM outside of React, React won't keep track of those changes. Updating the `key` will blow away the element and its children and result in a new node during reconciliation. Vue does not solve this, since it also relies on a VDOM. So both would "break" the same way. Only frameworks that uses the DOM as source of truth could potentially work (although there's likely other reasons it wouldn't).
@ddhello
@ddhello 3 ай бұрын
50% of this video confirmed once again why front side JS frameworks are bad
@98f5
@98f5 2 ай бұрын
You're right. He should use rust and egui
@98f5
@98f5 2 ай бұрын
Html sucks. Use webgl and render to the canvas
@shylvari
@shylvari 3 ай бұрын
how about muuri js?
@GeekOverdose
@GeekOverdose 3 ай бұрын
"its so easy to use" until you need to do something difficult :) then it becomes a nightmare to fight against
@AZioPb
@AZioPb 3 ай бұрын
Pragmatic drag and drop seems better for React,
@skavihekkora5039
@skavihekkora5039 3 ай бұрын
How much did they pay you
@paxdriver
@paxdriver 3 ай бұрын
I'll never understand why useless fragments are annoying but all the semicolons are fine lol
@earnstein7607
@earnstein7607 Ай бұрын
I thought everyone use framer-motion for DND
@slyrp6447
@slyrp6447 3 ай бұрын
i mean it just does not work on vanilla js???
@minimoon402
@minimoon402 Ай бұрын
It is so clear every time Theo makes an authoritative statement that he just does not understand how react or browser architecture works at all.
@casraf
@casraf 3 ай бұрын
I had this idea a few months ago and wrote it down as possible package to make God I hate myself
@crowlsyong
@crowlsyong 3 ай бұрын
If you won't love yourself, then I will _opens arms in anticipation of hug_ . ❤
@jeslinmx22
@jeslinmx22 3 ай бұрын
congrats, someone else made it, so now you don't have to make it yourself and maintain it for free for the rest of time!
@casraf
@casraf 3 ай бұрын
@@jeslinmx22 I'd rather have problems of success than nothings of lazyness :P
@deepakkumarkhatri
@deepakkumarkhatri 3 ай бұрын
Share the repo so we all can contribute together to make a better one which use more of react stuff
@casraf
@casraf 3 ай бұрын
@@nofacee94 I already said I hate myself, you don't have to sell it to me
@TheDr12345
@TheDr12345 3 ай бұрын
please remove the useEffect and use ref callback without query selector
@Kane0123
@Kane0123 3 ай бұрын
Javascript is now officially low code.
@madmarchy5176
@madmarchy5176 3 ай бұрын
Dockview looked cool until I tried to load it in safari 😭
@engine_man
@engine_man 3 ай бұрын
I’d prefer to learn how to build this instead of just keep installing packages
@frederickobeng-nyarko2868
@frederickobeng-nyarko2868 3 ай бұрын
8am … watching this… 😂
@TheLazyCat000
@TheLazyCat000 3 ай бұрын
already bots here
@okadz7037
@okadz7037 3 ай бұрын
cool
@aaronpage8878
@aaronpage8878 3 ай бұрын
DRAG AND DROP MENTIONED
@tomeknaj
@tomeknaj 3 ай бұрын
LLLET'S GO
@garcipat
@garcipat 3 ай бұрын
swappy seem to not respect the setting qutoanimate does
Why Everyone Loves Zustand
29:27
Theo - t3․gg
Рет қаралды 112 М.
The "Wrong Way" To Use React
39:30
Theo - t3․gg
Рет қаралды 141 М.
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 74 МЛН
Drag and Drop in React (Complete Tutorial)
20:08
Cosden Solutions
Рет қаралды 15 М.
The fastest website ever?
30:48
Theo - t3․gg
Рет қаралды 163 М.
Svelte makes Drag And Drop API easy!
15:08
Antonio Sarcevic
Рет қаралды 22 М.
The Secret Language Scaling WhatsApp and Discord
28:32
Theo - t3․gg
Рет қаралды 176 М.
Why Everyone Hates Web Components
1:22:39
Theo - t3․gg
Рет қаралды 82 М.
This tool annoyed me (so I built a free version)
19:38
Theo - t3․gg
Рет қаралды 238 М.
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 847 М.
Tailwind V4 is WAY better than I expected
30:17
Theo - t3․gg
Рет қаралды 126 М.
Next.js has real competition now
39:49
Theo - t3․gg
Рет қаралды 106 М.
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН