-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplifies hasValidReactChildren #1764
Simplifies hasValidReactChildren #1764
Conversation
@adrai how do you feel about making some changes that might potentially be breaking changes? I'm thinking about optional chaining and removing the code here: Lines 56 to 96 in 92bc147
Both of these changes should be supported by the current build config as far as I can tell. Browserslist is configured to only target the |
same topic like i18next/i18next#2184 |
What about removing the old code then? That has nothing to do with system compatibility and should be fine as long as the peer versions are followed. |
yes, I think 3 years later, we can remove that old code for a future major version (also conditional chaining)... |
Sounds good! I'll go through the code a final time and see if I find any other small opportunities to optimise the current code without breaking changes. |
Simplifies
hasValidReactChildren
a bit by utilizing Array.isArray, implicit returns and the fact that.every()
can take a function without arguments as it's own argument.This no longer returns false when it's not an array but rather implicitly returns
undefined
which don't affect current functionality as the code it's used in just checks for truthy values.Checklist
npm run test