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:
blam
2022-02-09 14:29:47 +01:00
parent 0d181683e8
commit 9643f75a11
@@ -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;
}
});
}