Advertisement
Guest User

Component

a guest
Nov 27th, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react'
  2. import { useDrag } from 'react-dnd'
  3.  
  4. export function SortedListItem(props){
  5.  
  6.   const { data } = props
  7.   const [{ opacity }, dragRef] = useDrag(
  8.       () => ({
  9.         type: "CARD",
  10.         item: "1",
  11.         collect: (monitor) => ({
  12.           opacity: monitor.isDragging() ? 0.5 : 1
  13.         })
  14.       }),
  15.       []
  16.     )
  17.   return (
  18.       <div ref={dragRef} >
  19.           <li>{data.name}</li>
  20.           {props.children}
  21.       </div>
  22.   )
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement