Posts

Showing posts from June, 2025

CES Vue and ReactJS

CES Vue and ReactJS   📌 1. Vue.js Lifecycle Hooks Vue provides various lifecycle hooks that allow you to add code at specific stages of a component's life: ✅ beforeCreate – Runs after instance initialization, before data observation and events setup. ✅ created – Runs after data observation and events are set up. API calls and data initialization are often done here. ✅ beforeMount – Called before mounting begins, i.e., before the DOM is rendered. ✅ mounted – Called after the component is mounted to the DOM. You can access the DOM elements here. ✅ beforeUpdate – Called before the DOM updates when reactive data changes. ✅ updated – Called after the DOM has been updated. Use with caution to avoid infinite loops. ✅ beforeUnmount (Vue 3) – Called before a component is unmounted. ✅ unmounted (Vue 3) – Called after a component is removed from the DOM. 🔗 Example usage: export default { data() { return { message: "Hello" }; }, created() { console....

[x]cube LABS React.js Interview

 1. Tell me about experience and previous projects 2. Closure 3. Deep Copy & Shallow Copy' 4. Dynamic Scope 5. Memory Leak 6. React Hooks 7. Dynamic Routing 8. Redux & Redux Lifecycle 9. Causes of unnecessary Rerendering. 10. Debouncing,  11. Event Loop 12. Write a logic to sum of all numbers const obj = { a: 1, b: { c: 2, d: { e: 3 } } }; Code: function sumNestedValues(obj) {   let sum = 0;   function recursiveSum(value) {     if (typeof value === 'number') {       sum += value;     } else if (typeof value === 'object' && value !== null) {       for (let key in value) {         recursiveSum(value[key]);       }     }   }   recursiveSum(obj);   return sum; } const result = sumNestedValues(obj); console.log(result); // Output: 6