-
Notifications
You must be signed in to change notification settings - Fork 795
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
Prop Mutability #1927
Comments
The same thing keeps happening me, with 1.8.8 version |
I'm also a bit confused using version 1.12.6. |
This had happened with me as well.... Is there anything that had been changed from the new version but it is not been updated in the documentation??? I had put the prop value on didload but without me specifying mutable: true, it is still updated. If someone is aware of the reason kindly let me know!!! import { Component, ComponentInterface, h, Prop} from '@stencil/core'; @component({ this.message ="kkkk" {this.message} ); } } |
Stencil document is confusing, prop values are mutable inside component irrespective of the 'mutable' option. |
I'm using 2.0.1 and experiencing the very same problem here. |
See my comment here. I'm looking into why the warning isn't emitted.
|
@claviska That should be enough to help with this issue. |
Any prop can be changed outside of the component, immutable or not, otherwise it would be a constant. |
While we don't stop props from mutating, we can (and always intended to) emit a warning in dev. That logic has been fixed in #2779. |
As per documentation, https://stenciljs.com/docs/properties#prop-mutability -
It's important to know, that a Prop is by default immutable from inside the component logic. Once a value is set by a user, the component cannot update it internally.
However, I can set new value to the
prop
without declaring it asmutable
.Code
The above code log "New Green" to console as well render updated value of property
color
.It would be great if you could clarify the exact purpose of
mutable
property?The text was updated successfully, but these errors were encountered: