chore: added guards as these could be string types which don't have props...
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -89,12 +89,15 @@ export function TabbedCard(props: PropsWithChildren<Props>) {
|
||||
let selectedTabContent: ReactNode;
|
||||
if (!value) {
|
||||
React.Children.map(children, (child, index) => {
|
||||
if (index === selectedIndex) selectedTabContent = child?.props.children;
|
||||
if (React.isValidElement(child) && index === selectedIndex) {
|
||||
selectedTabContent = child?.props.children;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
React.Children.map(children, child => {
|
||||
if (child?.props.value === value)
|
||||
if (React.isValidElement(child) && child?.props.value === value) {
|
||||
selectedTabContent = child?.props.children;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user