'use client' import { useEffect, useState } from 'react' import Draggable from 'react-draggable' export default function WithDraggable({ isShow, children, pos }) { const [position, setPosition] = useState({ x: 0, y: 0 }) const handleOnDrag = (data) => { setPosition({ x: data.x, y: data.y }) } useEffect(() => { setPosition({ ...pos }) }, []) return ( <> {isShow && ( handleOnDrag(data)}> {children} )} ) }