Valid use case of mutating props #6039
zeodtr
started this conversation in
General Discussions
Replies: 2 comments 2 replies
-
sounds like vuejs/rfcs#279 |
Beta Was this translation helpful? Give feedback.
1 reply
-
Additional idea. 'vue/no-mutating-props' warning from ESLint can be avoided with this code pattern: function mutateProp(propName: string, func(prop) => void) {
func(props[propName]);
}
...
mutateProp('anObjectProp', (prop) => prop.abcd = 123); If this |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I encounter the following case frequently and I think it is a valid use case of mutating props.
In Vue, there are two limited options.
I think there can be a third option:
If the maintainability of source code is worried, a prop property 'mutable' can be introduced to mark the case.
Any comment is welcomed.
Beta Was this translation helpful? Give feedback.
All reactions