fix: filter out empty children
This commit is contained in:
13
components/TempDesignSystem/utils/checkForEmptyChildren.ts
Normal file
13
components/TempDesignSystem/utils/checkForEmptyChildren.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Children, type ReactNode } from "react"
|
||||
|
||||
export function checkForEmptyChildren(children: ReactNode) {
|
||||
return Children.toArray(children).filter((child) => {
|
||||
if (child === "") {
|
||||
return false
|
||||
} else if (child == null) {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}).length
|
||||
}
|
||||
Reference in New Issue
Block a user