-
Notifications
You must be signed in to change notification settings - Fork 545
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
Optional props declaration #25
Conversation
How in this case would be handled the matter of different props casing? Will props exposed in
|
it would make sense to always receive a camel-cased in js no matter what version is used on the template |
@posva you've written |
What would happen if there are props declared? I really like the explicit props declaration. It's like a contract between a child and its parent component. Would be even nicer if we could declare events but I digress. Anyway, I would be quite upset if people in my team would stop declaring props. |
@gregaton Functional components aren't those just pure templates as we have still known. Look at #27 (comment) So, I suppose, it's better to think how to optionally prevent teammates from not declaring props in particular teams and cases. I'm into it, by the way. |
It sounds like it but I know too little about the implementation details to say if it's feasible or not. |
Sounds a bit confusing If we declare What will be the recommended way to access passed values to the component? Seems the newcomers would probably abuse |
Is that an "all or nothing" approach or can we declare some props and still let the component accept other props? ANSWER: Yes, the rest of the props will be available as |
@gustojs anything not explicitly declared goes into |
This RFC is now in final comments stage. An RFC in final comments stage means that:
|
Could this be limited to functional components only? As it was stated earlier props define a contract between parent and child. Leaving that out creates space for confusion. Especially when we already have |
@CyberAP I agree declaring props is preferable in most cases, but this change does not change best practices. It provides an interesting option in edgecases where being able to have all (or some) props in a bucket is convenient or more performant, and providing some alternate ways to pass data. I don't think this feature changes that especially because these props are referenced differently ( There could be an eslint rule to encourage declaring props as well. |
Note: this RFC has been revoked and superseded by #154
Rendered