[React] 클릭&더블클릭 이벤트

const timer = useRef<NodeJS.Timeout>()

const doubleClick = (request: Tree.RetrieveRes) => {
  console.log(request.showBtnGroup);
  request.showBtnGroup = !request.showBtnGroup;
}

const onClickHandler = async (event: any, request: Tree.RetrieveRes) => {
  clearTimeout(timer.current!);

  if (event.detail === 1) {
    timer.current = setTimeout(async () => showDirectories(request), 100)
  } else if (event.detail === 2) {
    doubleClick(request);
  }
}

links

social