Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@dnd-kit/core
Advanced tools
dnd kit – a lightweight React library for building performant and accessible drag and drop experiences
The @dnd-kit/core package provides a comprehensive set of tools for building complex drag and drop interfaces with ease. It is designed to be highly customizable and extensible, allowing developers to implement a wide range of drag and drop scenarios, from simple list reordering to complex nested structures and beyond. The core package focuses on providing the fundamental building blocks for drag and drop functionality, leaving UI and styling decisions up to the developer.
Basic Drag and Drop
This feature allows for the implementation of basic drag and drop functionality within your application. The DndContext component is used to wrap around the draggable elements, providing the necessary context for drag and drop interactions.
{"import {DndContext} from '@dnd-kit/core';
function App() {
return (
<DndContext>
{/* Your draggable items here */}
</DndContext>
);
}"}
Sorting
This feature enables sorting functionality within a list of items. By using the DndContext in combination with sensors and a sorting utility function like arrayMove, developers can easily implement draggable lists where items can be reordered.
{"import {DndContext, useSensor, PointerSensor} from '@dnd-kit/core';
import {arrayMove} from '@dnd-kit/sortable';
function App() {
const sensors = [useSensor(PointerSensor)];
const handleDragEnd = (event) => {
const {active, over} = event;
if (active.id !== over.id) {
setItems((items) => {
const oldIndex = items.findIndex((item) => item.id === active.id);
const newIndex = items.findIndex((item) => item.id === over.id);
return arrayMove(items, oldIndex, newIndex);
});
}
};
return (
<DndContext sensors={sensors} onDragEnd={handleDragEnd}>
{/* Your sortable items here */}
</DndContext>
);
}"}
react-beautiful-dnd is a popular drag and drop library for React. It offers a high-level API that focuses on creating beautiful, fluid, and accessible drag and drop lists. Compared to @dnd-kit/core, react-beautiful-dnd is more opinionated in terms of its design and functionality, providing out-of-the-box solutions for list reordering but may not offer the same level of customization and control for more complex scenarios.
react-dnd is a flexible drag and drop library for React, built on top of the HTML5 drag and drop API. It provides a set of hooks and components to build complex drag and drop interfaces. While react-dnd offers a great deal of flexibility and control, it can have a steeper learning curve compared to @dnd-kit/core. react-dnd's reliance on the HTML5 drag and drop API also means it may not be as suited for touch devices without additional work.
FAQs
dnd kit – a lightweight React library for building performant and accessible drag and drop experiences
We found that @dnd-kit/core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.