fix subtle tabs bug

This commit is contained in:
mantikoros 2022-06-16 11:29:04 -05:00
parent c2945f11b7
commit 6c6f03e622

View File

@ -19,7 +19,7 @@ export function Tabs(props: {
}) { }) {
const { tabs, defaultIndex, className, onClick } = props const { tabs, defaultIndex, className, onClick } = props
const [activeIndex, setActiveIndex] = useState(defaultIndex ?? 0) const [activeIndex, setActiveIndex] = useState(defaultIndex ?? 0)
const activeTab = tabs[activeIndex] const activeTab = tabs[activeIndex] as Tab | undefined // can be undefined in weird case
return ( return (
<div> <div>
@ -55,7 +55,7 @@ export function Tabs(props: {
</nav> </nav>
</div> </div>
<div className="mt-4">{activeTab.content}</div> <div className="mt-4">{activeTab?.content}</div>
</div> </div>
) )
} }