🚀 30 Days — 30 Coding Mistakes Beginners Make Day 13/30 I copied an object… and the original data changed 😐 const newUser = user Then I updated newUser… and user also changed. Because objects in JavaScript are stored by reference, not value. Both variables pointed to the same memory. Fix 👇 const newUser = { ...user } Now a new object is created. This concept is very important in React state updates and debugging strange UI behavior. Day 14 tomorrow 👀 #30DaysOfCode #javascript #reactjs #frontend #webdevelopment #codeinuse
JavaScript Object References and React State Updates
More Relevant Posts
-
⚠️ JavaScript Mistakes Every Developer Should Know Even experienced developers make these mistakes… avoid them 👇 ❌ Using == instead of === 👉 Can cause unexpected results due to type conversion ❌ Forgetting return in functions 👉 Function runs but returns undefined ❌ Not handling asynchronous code 👉 Code executes before data is ready ❌ Mutating objects/arrays directly 👉 Can lead to unexpected bugs ❌ Ignoring this behavior 👉 this depends on how a function is called ❌ Using var instead of let/const 👉 Leads to scope-related issues 🔥 Key Takeaway: Small mistakes in JavaScript can lead to big bugs. Write clean and predictable code. 💬 Which mistake have you made before? #javascript #webdevelopment #frontend #coding #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 30 Days — 30 Coding Mistakes Beginners Make Day 16/30 My component received a new userId… but UI still showed the old user 😐 The reason? I wrote: useEffect(() => { fetchUser(userId) }, []) Empty dependency array means: run only once on mount. So when userId changed, React never fetched new data. Fix 👇 useEffect(() => { fetchUser(userId) }, [userId]) Dependencies tell React WHEN to re-run the effect. Missing dependency = stale UI data. Day 17 tomorrow 👀 #30DaysOfCode #reactjs #javascript #frontend #webdevelopment #codeinuse
To view or add a comment, sign in
-
-
State vs Props in React Simplified: If you're learning React, this is one of the most important concepts to understand 1. State: Managed inside the component Can be updated (mutable) Used for dynamic data (like counters, inputs) 2. Props: Passed from parent to child Read-only (immutable) Used to share data between components In short: State = “owned data” Props = “received data” Understanding this difference helps you write cleaner and more predictable React code. What confused you more when learning React: State or Props? #React #JavaScript #WebDevelopment #Frontend #Coding #100DaysOfCode
To view or add a comment, sign in
-
-
Day 7 of “Js in bits series – (Datatypes - undefined)” Key ideas covered in the article: 🔹 What undefined actually represents 🔹 When JavaScript automatically assigns undefined 🔹 Common scenarios where developers encounter it 🔹 The difference between undefined and null 👉 https://lnkd.in/gSN7MqSY #javascript #webdevelopment #frontend #softwareengineering #coding #learning
To view or add a comment, sign in
-
-
While learning JavaScript, I wanted to understand the actual flow of asynchronous operations. This simple diagram shows the sequence from fetch() to Promises, async/await, error handling with try/catch, and finally organizing code using ES Modules. I learned these concepts from Devendra Dhote bhaiya and tried to visualize the flow in a simple way. Breaking concepts into small visual steps makes asynchronous JavaScript much easier to understand. #javascript #webdevelopment #frontend #learninginpublic #sheryians
To view or add a comment, sign in
-
🚀 30 Days — 30 Coding Mistakes Beginners Make Day 14/30 I called an object method… and it printed: Hello undefined 😐 const user = { name: "Sam", greet: () => console.log(this.name) } The mistake: Arrow functions don’t have their own `this`. They inherit `this` from the outer scope, so it was not pointing to the object. Fix 👇 Use a normal function for object methods. Arrow functions are great for callbacks, but not for object methods. Small syntax change. Correct behavior. Day 15 tomorrow 👀 #30DaysOfCode #javascript #reactjs #frontend #webdevelopment #codeinuse
To view or add a comment, sign in
-
-
🚀 React Fundamentals: Key Concepts Every Beginner Should Know 🔹 Components Components are the building blocks of a React application. They allow us to divide the UI into independent, manageable pieces, making code easier to understand and maintain. 🔹 Reusable Components A reusable component is designed once and used multiple times across the application. This helps reduce code duplication and keeps the application consistent and scalable. . 🔹 Dynamic Data Binding Dynamic data binding allows React to update the UI automatically when the data changes. This ensures that the user interface always reflects the latest state of the application. 💡 Small reusable pieces + dynamic data = powerful and scalable UI. #React #FrontendDevelopment #JavaScript #WebDevelopment #Programming #SoftwareDevelopment #LearningInPublic
To view or add a comment, sign in
-
🚀 Simplifying JavaScript Promises! Understanding asynchronous operations can be tricky, but Promises make it easier to handle tasks like API calls, error handling, and chaining multiple operations. This infographic breaks it down step by step, from creating a Promise to handling results and chaining them. Perfect for developers looking to strengthen their JS fundamentals! 💻✨ #JavaScript #WebDevelopment #Coding #Programming #LearnToCode #FrontendDevelopment #AsyncProgramming #Promises #API #TechTips #Developers #SoftwareEngineering #CodeNewbie #JS
To view or add a comment, sign in
-
-
One thing that improves a developer faster than any course Reading and Understanding the code pattern. Not tutorials. Not reels. Not “top 10 React tricks”. Real code. • Code written by experienced developers • Code inside open-source libraries • Code from production systems You start noticing patterns: Why was something designed a certain way. Why some abstractions are simple. Writing code teaches you syntax. Reading code teaches you thinking. Both matter. Most developers only do one. #frontend #softwareengineering #javascript #careeradvice #react
To view or add a comment, sign in
-
Ever spent hours chasing bugs only to find the simplest mistake? You write code. It doesn’t work. You spend hours debugging. Then suddenly… the bug reveals itself — in the least expected way. Sometimes, the breakthrough is just one insight away. Keep going. #FullStackDeveloper #MERNStack #NodeJS #ReactJS #JavaScript #RESTAPI #ReduxToolkit #TailwindCSS #WebDevelopment #FrontendDevelopment #BackendDevelopment #ResponsiveDesign #TechSolutions #UserFocusedDesign #SoftwareEngineering #CodingLife #DeveloperCommunity #ModernWebApps #ProgrammingTips #WebDevProjects
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Clear explanation by Lokesh. Understanding object references in JavaScript prevents many hidden bugs in applications.