Closed
Description
This component is no longer recognised if I removed the superfluous return <noscript/>
at the end. The static analyser seems to have a problem also when I would just remove the last else
clause since its also not really needed for the correct flow.
But docgen's parser does not seem to understand, that null
is also a valid return for a components render function.
const required = name => {
throw new TypeError(`${name} is required`)
}
const ExtensionPoint = ({
extensionName = required("extensionName"),
children,
...props }) => {
const Extension = getExtension(extensionName)
if (typeof children === "function") {
return children(Extension, props) || null
} else if (typeof Extension !== "undefined") {
return Extension ? <Extension {...props} /> : null
} else {
return children || null
}
return <noscript/>
}
Metadata
Metadata
Assignees
Labels
No labels