import { motion } from "framer-motion"; import { useAtom } from "jotai"; import React, { useEffect, useMemo, useState } from "react"; import { selectedIndexAtom } from "./TabList"; const TabPanels = (props: { children?: React.ReactNode; eager?: boolean }) => { const { tabPanels } = useTabPanel(props.children); const [index, setIndex] = useAtom(selectedIndexAtom); const [loadingMap, setLoadingMap] = useState<{ [key: number]: boolean }>({}); useEffect(() => { if (index != null && !loadingMap[index]) { const assigned = Object.assign({}, loadingMap); assigned[index] = true; setLoadingMap(assigned); } }, [index]); return (