From bdcf082c02f67459ac1f42b0df69a979e9ab6d25 Mon Sep 17 00:00:00 2001 From: Mark Tallentire Date: Fri, 3 Dec 2021 09:11:16 +0000 Subject: [PATCH 1/2] Update Prop Mutation Docs to be more clear around mutation --- src/guide/component-props.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/guide/component-props.md b/src/guide/component-props.md index c38a42dad2..30ab96c3b4 100644 --- a/src/guide/component-props.md +++ b/src/guide/component-props.md @@ -154,8 +154,8 @@ computed: { } ``` -::: tip Note -Note that objects and arrays in JavaScript are passed by reference, so if the prop is an array or object, mutating the object or array itself inside the child component **will** affect parent state. +::: warning Warning +Note that objects and arrays in JavaScript are passed by reference, so if the prop is an array or object, mutating the object or array itself inside the child component **will** affect parent state and vue is unable to warn you against this. As a general rule, you should avoid mutating any prop, including objects and arrays as doing so ignores one way data binding and may cause undesired results. ::: ## Prop Validation From 2a9be8dfde7329f7fbda295ce4c8a5aa719afb2f Mon Sep 17 00:00:00 2001 From: Natalia Tepluhina Date: Wed, 8 Dec 2021 18:55:47 +0200 Subject: [PATCH 2/2] Update src/guide/component-props.md --- src/guide/component-props.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guide/component-props.md b/src/guide/component-props.md index 30ab96c3b4..6a2a45f264 100644 --- a/src/guide/component-props.md +++ b/src/guide/component-props.md @@ -155,7 +155,7 @@ computed: { ``` ::: warning Warning -Note that objects and arrays in JavaScript are passed by reference, so if the prop is an array or object, mutating the object or array itself inside the child component **will** affect parent state and vue is unable to warn you against this. As a general rule, you should avoid mutating any prop, including objects and arrays as doing so ignores one way data binding and may cause undesired results. +Note that objects and arrays in JavaScript are passed by reference, so if the prop is an array or object, mutating the object or array itself inside the child component **will** affect the parent state and Vue is unable to warn you against this. As a general rule, you should avoid mutating any prop, including objects and arrays as doing so ignores one-way data binding and may cause undesired results. ::: ## Prop Validation