Simple SortableList component (TypeScript) #1055
remitoffoli
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
Today, I stumbled upon react-sortable-hoc and played with it until I noticed it wasn't maintained anymore in favor of dnd-kit. I then struggled a lot with the complexity of dnd-kit, which I guess is missing plug-and-play components for general use cases. I found the examples, but they're so complexly built, that I couldn't copy/paste anything from it.
So I decided to create my own simple SortableList (like the ones in Notion):
And wrap it with a generic and easy-to-use component (also getting around the requirement or an
id
property on your items):You can check the TypeScript code here: https://codesandbox.io/s/angry-hamilton-qixv4m?file=/src/App.tsx:973-1823
I hope this helps.
And thanks @clauderic for all the effort building this lib. It's complex for basic use cases, but it looks powerful. 😊🙌
Beta Was this translation helpful? Give feedback.
All reactions