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 react unkown props #17

Open
aymericbouzy opened this issue Feb 15, 2017 · 0 comments
Open

Fix react unkown props #17

aymericbouzy opened this issue Feb 15, 2017 · 0 comments

Comments

@aymericbouzy
Copy link

aymericbouzy commented Feb 15, 2017

when using the following syntax with React 15.x

Label {}
Label:prop(mode == 'edit') {}
<Label mode="edit"/>

React throws the following error:

Warning: Unknown prop `mode` on <div> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop

If I understand correctly what is being said here, you should be able to remove unknown props. Basically, that means that the syntax you are currently using should be deprecated.
I would suggest keeping to the variant prop:

<Label variant={{mode: 'edit'}} />

Tell me what you think.

EDIT: On second thoughts, the syntax is still very useful in many cases. For instance, you could choose to change the style of the component when onClick prop is set. I think it should be clearer in the doc that the library does not whitelist the props, and that you should use this feature only with props the component accepts.

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

No branches or pull requests

2 participants