-
Notifications
You must be signed in to change notification settings - Fork 41
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
Unnecessary props passed to DOM #95
Comments
I know, but I consider the effort to remove it implies more cost than simply pass it what do you think? |
Yeah I had a quick go at it and gave up quickly 😅 I was thinking we could create a small util. method, where we pass const propCleaner = (obj, excludeKeys) => {
const objKeys = Object.keys(obj)
return objKeys.reduce((acc, key) => {
if (!excludeKeys.include(key)) {
acc[key] = obj[key]
}
return acc
})
}
<Component {...propCleaner(props, ['apiKey', 'autoPlay'])} /> (not ran/tested) |
Yep that seems to do basically what I was suggesting. We'll have to see how the size looks with it included - https://bundlephobia.com/result?p=clean-tag@1.0.4 |
I would not worry unless it represents a problem The cost of add 11kb extra size into the library vs 0kb, also not logic for handle this 🙂 |
Just came across this @Kikobeats. Lodash's omit should do the trick. I think we should implement this as we're generating slightly unsemantic markup, passing "media" attributes (autoplay, etc) to DOM elements that shouldn't receive them. |
agree! |
Some props are leaking through to the DOM (unnecessarily) ☝️ (
autoplay
,controls
, etc)The text was updated successfully, but these errors were encountered: