Preview:
  const updateHandler = async () => {
    const code = tabs[activeIndex]?.code;

    const updateQueryData = {
      queryName: tabs[activeIndex]?.name,
      query: code,
      email: user.email,
    };
    const updatedQuery = await QueryDataService.updateQuery(
      tabs[activeIndex].id,
      updateQueryData,
    );
    console.log('A========>', savedQueryList);
    const findSavedIndex = savedQueryList.findIndex(
      (query) => query.id === updatedQuery.id,
    );
    tabs[activeIndex] = {
      ...tabs[activeIndex],
      code: updatedQuery.query,
      name: updatedQuery.queryName,
      email: updatedQuery.email,
      id: updatedQuery.id,
      ismodified: false 
    };
    if (findSavedIndex > -1) {
      savedQueryList[findSavedIndex] = {
        ...updatedQuery,
      };
    }
    setSavedQueryList([...savedQueryList]);
    setTabs([...tabs]);
    // showUpdate();
  };
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter