(props: {children?: ReactNode})
| 65 | } |
| 66 | |
| 67 | export function ClearSlots(props: {children?: ReactNode}): ReactNode { |
| 68 | let {children, ...otherProps} = props; |
| 69 | |
| 70 | const emptyObj = useMemo(() => ({}), []); |
| 71 | |
| 72 | let content = children; |
| 73 | if (React.Children.toArray(children).length <= 1) { |
| 74 | if (typeof children === 'function') { |
| 75 | // need to know if the node is a string or something else that react can render that doesn't get props |
| 76 | content = React.cloneElement(React.Children.only(children), otherProps); |
| 77 | } |
| 78 | } |
| 79 | return <SlotContext.Provider value={emptyObj}>{content}</SlotContext.Provider>; |
| 80 | } |
nothing calls this directly
no outgoing calls
no test coverage detected