Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Don't pass children to React component if not present #163

Open
thany opened this issue Dec 1, 2022 · 0 comments
Open

Don't pass children to React component if not present #163

thany opened this issue Dec 1, 2022 · 0 comments

Comments

@thany
Copy link

thany commented Dec 1, 2022

Consider this React component called in a Vue template:

<hello-from-react />

Couldn't be simpler. But it passes children which aren't there at all. Using forbidExtraProps from airbnb-prop-types it fails prop-type validation.

Please ONLY pass children if a component has content, a <slot>, or an explicit children prop.

Same problem occurs in that other superfluous prop.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant