Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
react-tnm-drag
Advanced tools
npm install react-tnm-drag
import { useDragReducer, useDrag, useDragContainer } from 'react-tnm-drag'
const { dragState, dragReducer } = useDragReducer(
"number", // [Required] string with the item.id type (either "number" or "string")
"number", // string with the container identifier type (If there are several arrays)
"string" // string with the container of the container identifier type (If there are several arrays of arrays)
)
const propsForDraggableItem = useDrag(
dragState, // [Required] Comes from useDragReducer
dragReducer, // [Required] Comes from useDragReducer
item.id, // [Required] identifier (Should be the type as the first parameter of useDragReducer)
index, // [Required] Array index of the item
performMovement, // [Required] Function you give to actually move the item in the array probably with some array.splice()
"horizontal", // string with the direction of the list (Defaults to "vertical")
desapearDelay, // ms after dropping until the dragged item will dissapear (Defaults to 0)
ref // React.refObject from the component (Will be created internally if not provided)
)
const propsForContainer = useDragContainer(
"oneContainer", // [Required] string stating which container this function is for (either "oneContainer", "firstContainer" or "secondContainer")
dragState, // [Required] Comes from useDragReducer
dragReducer, // [Required] Comes from useDragReducer
container.id, // [Required] identifier (Should be the type as the first parameter of useDragReducer)
index, // [Required] Array index of the item
)
See the example [react project] for more details (Coming soon)
FAQs
Package to allow easy drag and drop of React components
We found that react-tnm-drag 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.