Using react-dnd 16 with Next.js 14 and TypeScript, the refs within the return array of the useDrag and useDrop hooks are not assignable to LegacyRef. Other plataforms as Vite.Js gets the type fine.
Same code works in both, but nextjs gets type error.
const [{ isDragging }, dragRef] = useDrag(() => ({ ... })); <div ref={dragRef}> .... </div> Even with cast it can't be solved. How can I solve this type error?
Error: Type 'ConnectDragSource' is not assignable to type 'LegacyRef | undefined'.