From fb2a8f6595bd8b70c131e181a52e11abc3f75fe1 Mon Sep 17 00:00:00 2001 From: rahimasalman Date: Mon, 25 Mar 2024 20:57:29 +0400 Subject: [PATCH 1/2] Question 226: add answer --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7e6d0e9..ea08c35 100644 --- a/README.md +++ b/README.md @@ -4944,6 +4944,8 @@ List of 300 VueJS Interview Questions 226. ### What happens if you use duplicate field names? + Using duplicate field names in a component's data, computed, or methods sections might cause unexpected behavior and bugs in Vue 3. The last defined property will override the previous one, which could lead to confusion or logical errors in your component. + Overwriting can occur in Vuex when duplicate field names are used in state, mutations, actions, or getters. The last defined field will override the previous ones, which may cause unexpected behavior or bugs in your application's state management. **[⬆ Back to Top](#table-of-contents)** 227. ### Why the component data must be a function? From 9a553c98a7f2b3d48a8b6efae1b2b47103b61d9b Mon Sep 17 00:00:00 2001 From: rahimasalman Date: Wed, 4 Sep 2024 10:31:52 +0400 Subject: [PATCH 2/2] feat: improve answer --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d9be049..3d9e06e 100644 --- a/README.md +++ b/README.md @@ -4950,8 +4950,8 @@ List of 300 VueJS Interview Questions 226. ### What happens if you use duplicate field names? - Using duplicate field names in a component's data, computed, or methods sections might cause unexpected behavior and bugs in Vue 3. The last defined property will override the previous one, which could lead to confusion or logical errors in your component. - Overwriting can occur in Vuex when duplicate field names are used in state, mutations, actions, or getters. The last defined field will override the previous ones, which may cause unexpected behavior or bugs in your application's state management. +Using duplicate field names within a component's data, computed properties, or methods may lead to unexpected behaviors and potential bugs in Vue 3 applications. The property defined last will take precedence, potentially leading to confusion or logical errors. Similarly, in Vuex, defining fields with the same name across state, mutations, actions, or getters can cause the last definition to overwrite earlier ones. +This might result in unpredictable behavior or errors in managing your application's state. **[⬆ Back to Top](#table-of-contents)** 227. ### Why the component data must be a function?