Skip to content
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

Fix react15 warning about unknown props #36

Merged

Conversation

jairtrejo
Copy link
Contributor

@jairtrejo jairtrejo commented Jul 4, 2016

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 child div using ..., the div ends up with invalid html properties.

Solution

Coffeescript doesn't seem to have support for the succinct solution:

const { layout, ...rest } = props;
return <div {...rest} />

So I used Object.assign for making a copy of props and then removing the unwanted keys.

Test plan

I built the project by:

  1. Running npm install
  2. Installing webpack globally
  3. Installing React locally (perhaps consider including it in peerDependencies)
  4. Running make build

And tested it in my project using npm link. It stopped showing the warning!

@jairtrejo
Copy link
Contributor Author

Hi, @KyleAMathews ! Just wanted to ping you 😄

@KyleAMathews
Copy link
Owner

This is great! Thanks @jairtrejo! Just reviewed and will now merge and create a new release.

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

Successfully merging this pull request may close these issues.

2 participants