fix subtle tabs bug
This commit is contained in:
parent
c2945f11b7
commit
6c6f03e622
|
@ -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>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user