Fix react15 warning about unknown props #36
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Links
Problem
"The unknown-prop warning will fire if you attempt to render a DOM element with a prop that is not recognized by React as a legal DOM attribute/property." In this case, since
@props
are passed as-is to the childdiv
using...
, the div ends up with invalid html properties.Solution
Coffeescript doesn't seem to have support for the succinct solution:
So I used
Object.assign
for making a copy of props and then removing the unwanted keys.Test plan
I built the project by:
npm install
peerDependencies
)make build
And tested it in my project using
npm link
. It stopped showing the warning!