I recently worked on a feature where I used URL parameters to display a specific product and track its delivery status on a separate page. In this video, I walked through how I implemented it from passing orderId and productId through the URL, to retrieving them on the tracking page and using them to render the correct product and delivery progress. This task pushed me to better understand: -How URL parameters work in real applications -Handling bugs like missing or incorrect parameters -Managing data flow between pages -Updating the UI dynamically based on real-time calculations (like delivery progress) It wasn’t just about getting it to work, but understanding why it works and fixing the issues that came up along the way. Still learning and improving every day 🚀 #JavaScript #FrontendDevelopment #WebDevelopment #LearningInPublic #BeginnerDeveloper
More Relevant Posts
-
1,200 lines of form code deleted from a production dashboard — and the forms actually work better now. That's what happens when you swap React Hook Form for React 19's built-in Actions + useActionState on the right kind of project. Here's the thing most tutorials won't tell you: this isn't a blanket "RHF is dead" story. It's a "know when to use what" story. → Simple CRUD forms (login, contact, settings)? useActionState + useOptimistic handles it natively. No extra deps, no bundle cost, instant optimistic UI out of the box. → Complex dynamic forms (nested arrays, conditional fields, 50+ field wizards)? React Hook Form still wins. React 19 has no built-in validation beyond HTML attributes — and managing deeply nested field arrays without RHF is pain you don't need. → The middle ground is where it gets interesting. Forms with 5–15 fields and basic Zod validation? You can go either way. We leaned native and didn't look back. The real unlock isn't "drop the library." It's that React's form primitives finally work well enough that you can evaluate each form on its own complexity instead of reaching for RHF by default on every project. Three questions before you refactor: 1. Do any of your forms have dynamic field arrays? 2. Are you using RHF's validation resolver pattern heavily? 3. Is your form state shared across multiple components? If you answered "no" to all three, you might be carrying a dependency you don't need. What's your team's take still all-in on React Hook Form, or have you started migrating simpler forms to Actions? #ReactJS #FrontendDevelopment #WebDev #JavaScript #React19 #FormHandling #DeveloperProductivity
To view or add a comment, sign in
-
🚀 Frequently Asked Event Loop Interview Questions (with Answers) 🔹 1. What is the Event Loop? The Event Loop is a mechanism that allows JavaScript (single-threaded) to handle asynchronous operations by managing the execution of the call stack and callback queues. 🔹 2. How does JavaScript handle asynchronous tasks? It uses: • Call Stack (executes code) • Web APIs (handles async tasks like setTimeout, fetch) • Callback Queue (stores callbacks) • Event Loop (moves callbacks to stack when ready) 🔹 3. What is the difference between Microtask Queue and Callback Queue? • Microtask Queue → Promises, MutationObserver • Callback Queue (Macrotask) → setTimeout, setInterval 👉 Microtasks always execute before macrotasks. 🔹 4. What will be the output? console.log("Start"); setTimeout(() => { console.log("Timeout"); }, 0); Promise.resolve().then(() => { console.log("Promise"); }); console.log("End"); ✅ Output: Start End Promise Timeout 🔹 5. Why does Promise run before setTimeout (even with 0 delay)? Because Promises go to the Microtask Queue, which has higher priority than the Callback Queue. 🔹 6. Is JavaScript really single-threaded? Yes, but with the help of browser APIs and the Event Loop, it behaves asynchronously. 🔹 7. What happens if the Call Stack is busy? The Event Loop waits until the stack is empty before pushing new tasks. 🔹 8. What is Starvation in Event Loop? If microtasks keep getting added continuously, macrotasks (like setTimeout) may never execute → this is called starvation. #JavaScript #EventLoop #FrontendDevelopment #WebDevelopment #CodingInterview #AsyncJS
To view or add a comment, sign in
-
JavaScript isn’t hard unclear logic is. One thing I’ve learned while building real frontend features is this: Most bugs don’t come from JavaScript itself… They come from assumptions we make while writing it. Here’s a simple rule that has saved me countless hours: Always validate your data before using it. Because in real projects, you’re not just writing code you’re handling unpredictable inputs, API delays, null values, and user behavior. A few examples that prevent 80% of silent failures: • Check if an array actually exists before mapping • Confirm API responses before rendering UI • Avoid chaining methods on undefined • Never trust user input without validation • Use optional chaining when the structure isn’t guaranteed Small checks. Big impact. Clean code isn’t about writing more it’s about writing responsibly. When your logic is predictable, your UI becomes reliable. And reliability is what users remember. #JavaScript #FrontendDevelopment #WebDevelopment #CleanCode #TechTips #UIUX #DeveloperLife
To view or add a comment, sign in
-
-
🚀 Harness the power of JavaScript Promises to handle asynchronous tasks like a pro! 🌟 Promises are objects that represent the eventual completion or failure of an asynchronous operation. Simply put, they help you manage the flow of your code when dealing with time-consuming tasks. For developers, mastering Promises is crucial for writing efficient and scalable code, ensuring smooth execution of operations without blocking the main thread. Let's break it down step by step: 1️⃣ Create a new Promise using the new Promise() constructor. 2️⃣ Within the Promise, define the asynchronous operation you want to perform. 3️⃣ Resolve the Promise with the desired result or Reject it with an error. Here's a code snippet to illustrate: ``` const myPromise = new Promise((resolve, reject) => { // Asynchronous operation let success = true; if (success) { resolve("Operation successful!"); } else { reject("Operation failed!"); } }); myPromise .then((message) => { console.log(message); }) .catch((error) => { console.error(error); }); ``` Pro Tip: Always remember to handle both the resolve and reject outcomes to ensure robust error management. 🛠️ Common Mistake: Forgetting to include the .catch() method to handle errors can lead to uncaught exceptions, so be sure to always implement error handling. ❓ What's your favorite use case for JavaScript Promises? Share in the comments below! 🌐 View my full portfolio and more dev resources at tharindunipun.lk #JavaScript #Promises #AsyncProgramming #WebDevelopment #CodeNewbie #DeveloperTips #LearnToCode #TechCommunity #BuildWithDevSkills
To view or add a comment, sign in
-
-
🚀 𝗨𝗻𝗱𝗲𝗿𝘀𝘁𝗮𝗻𝗱𝗶𝗻𝗴 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗖𝗹𝗼𝘀𝘂𝗿𝗲𝘀 (The Secret Locker Story 😂) Ever felt like JavaScript remembers things even after they’re gone? 👀 Well… it actually does 😎 Let me explain 𝗖𝗹𝗼𝘀𝘂𝗿𝗲𝘀 in the simplest (and funniest) way 👇 🔐 1. Create a Locker with a Secret /* JavaScript * / function createLocker() { let secret = "💰 1 Crore Password"; return function() { console.log(secret); }; } JS be like: “Okay… I’ll keep this secret safe 🤫” 🎁 𝗧𝗮𝗸𝗲 𝘁𝗵𝗲 𝗟𝗼𝗰𝗸𝗲𝗿 𝗞𝗲𝘆 /* JavaScript * / const myLocker = createLocker(); Now the outer function is gone… finished… bye bye 👋 😳 𝗦𝗲𝗰𝗿𝗲𝘁 𝗔𝗯𝗵𝗶 𝗕𝗵𝗶 𝗟𝗶𝘃𝗲 𝗛𝗮𝗶 /* JavaScript * / myLocker(); // 💰 1 Crore Password JS says: “Function gaya toh kya hua… memory toh mere paas hai 😎” 🧠 𝗪𝗵𝗮𝘁 𝗷𝘂𝘀𝘁 𝗵𝗮𝗽𝗽𝗲𝗻𝗲𝗱? 👉 Inner function remembers outer function’s variables 👉 Even after outer function is finished 👉 This is called a Closure 😂 𝗥𝗲𝗮𝗹-𝗟𝗶𝗳𝗲 𝗔𝗻𝗮𝗹𝗼𝗴𝘆 It’s like: 👩 Mom hides sweets in a locker 🍫 🔑 Gives you the key 🏠 Leaves the house And you’re like: “अब तो मज़े ही मज़े 😎” ⚠️ 𝗜𝗺𝗽𝗼𝗿𝘁𝗮𝗻𝘁 𝗣𝗼𝗶𝗻𝘁 /* JavaScript * / const locker1 = createLocker(); const locker2 = createLocker(); 👉 Both lockers have their own secret (No sharing bro ❌😆) 💼 𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 𝗢𝗻𝗲-𝗟𝗶𝗻𝗲𝗿 Closure = A function that remembers variables from its outer scope even after the outer function has executed. 🔥 𝗡𝗼𝘄 𝘆𝗼𝘂𝗿 𝘁𝘂𝗿𝗻! Can you think of real use cases of closures? Drop in comments 👇👇 #JavaScript #WebDevelopment #Frontend #Coding #Programming #Developers #LearnToCode #Tech #SoftwareEngineering #ReactJS #100DaysOfCode #CodingLife
To view or add a comment, sign in
-
🔥 React DevTools: Common Issues & How to Use It Effectively React DevTools is one of the most powerful tools for diagnosing performance issues… but many developers don’t use it correctly. Here’s what I’ve learned 👇 ------------------------------------- 🔍 Common Issues Developers Face: 1️⃣ Not Profiling – Many just inspect components without measuring re-renders or performance. 2️⃣ Ignoring Component Trees – Deep trees hide unnecessary renders. 3️⃣ Overlooking State & Props – Changes in parent state can trigger unexpected child re-renders. 4️⃣ Misreading Flame Charts – Not understanding which operations are expensive. 💡 How to Use React DevTools Effectively: ------------------------------------------------- ✅ Profiler Tab – Measure every render and find bottlenecks. ✅ Highlight Updates – See exactly which components re-render. ✅ Inspect Component Props & State – Check if changes are causing unnecessary renders. ✅ Compare Commits – Analyze how updates affect your tree. ✅ Filter and Focus – Only measure the components that matter. 🚀 Pro Tip: “React DevTools doesn’t just show problems… it tells you exactly where to optimize.” 💬 Your Turn: Which feature of React DevTools helped you most in improving performance? #reactjs #reactdeveloper #webdevelopment #frontend #javascript #reactperformance #profiling #devtools #softwareengineering #frontendengineering #performanceoptimization #cleancode #techlead
To view or add a comment, sign in
-
-
⚡ Day 7 — JavaScript Event Loop (Explained Simply) Ever wondered how JavaScript handles async tasks while being single-threaded? 🤔 That’s where the Event Loop comes in. --- 🧠 What is the Event Loop? 👉 The Event Loop manages execution of code, async tasks, and callbacks. --- 🔄 How it works: 1. Call Stack → Executes synchronous code 2. Web APIs → Handle async tasks (setTimeout, fetch, etc.) 3. Callback Queue / Microtask Queue → Stores callbacks 4. Event Loop → Moves tasks to the stack when it’s empty --- 🔍 Example: console.log("Start"); setTimeout(() => { console.log("Timeout"); }, 0); Promise.resolve().then(() => { console.log("Promise"); }); console.log("End"); --- 📌 Output: Start End Promise Timeout --- 🧠 Why? 👉 Microtasks (Promises) run before macrotasks (setTimeout) --- 🔥 One-line takeaway: 👉 “Event Loop decides what runs next in async JavaScript.” --- If you're learning async JS, understanding this will change how you debug forever. #JavaScript #EventLoop #WebDevelopment #Frontend #100DaysOfCode 🚀
To view or add a comment, sign in
-
How JavaScript really works behind the scenes ⚙️🚀 1️⃣ User Interaction User clicks a button → event gets triggered 2️⃣ Call Stack Functions are pushed into the call stack and executed one by one (LIFO) 3️⃣ Web APIs Async tasks like setTimeout, fetch run outside the call stack 4️⃣ Callback Queue After completion, async tasks move into the queue 5️⃣ Event Loop It checks if the call stack is empty and pushes tasks back to it 6️⃣ DOM Update Finally, the browser updates the UI 🎯 Understanding this flow changed the way I write JavaScript 💻 To learn more, follow JavaScript Mastery What JavaScript concept confused you the most? 👇 #javascript #webdevelopment #frontenddeveloper #coding #learning
To view or add a comment, sign in
-
-
𝗟𝗲𝘁’𝘀 𝘁𝗮𝗹𝗸 𝗮 𝗹𝗶𝘁𝘁𝗹𝗲 𝗯𝗶𝘁 𝗮𝗯𝗼𝘂𝘁 𝗡𝗼𝗱𝗲.𝗷𝘀! 𝐓𝐨𝐩𝐢𝐜 𝟏: 𝐓𝐡𝐞 𝐍𝐨𝐝𝐞.𝐣𝐬 𝐄𝐯𝐞𝐧𝐭 𝐋𝐨𝐨𝐩 It’s a meticulously ordered cycle of 6 steps - and most developers have never seen the part that goes between each one. ⚙️ 𝘛𝘩𝘦 6 𝘚𝘵𝘦𝘱𝘴: 1️⃣ 𝘛𝘪𝘮𝘦𝘳𝘴: Recalls setTimeout / setInterval whose delay has passed 2️⃣ 𝘈𝘸𝘢𝘪𝘵𝘪𝘯𝘨 callbacks: Recalls I/O errors that were rejected from the previous iteration 3️⃣ 𝘗𝘰𝘭𝘭𝘪𝘯𝘨: Retrieves new I/O events. This is where Node.js waits when idle. 4️⃣ 𝘊𝘩𝘦𝘤𝘬: setImmediate callbacks, always after Poll 5️⃣ 𝘊𝘭𝘰𝘴𝘦 𝘊𝘢𝘭𝘭𝘣𝘢𝘤𝘬𝘴: socket.on('close'), cleanup handlers 💠The hidden layer: microtasks Between each step, before the loop progresses, Node.js completely empties the microtask queue. Two subqueues, processed in exact order: ➡️ process.nextTick() callbacks - always first ➡️ Promise resolution callbacks - second This means that microtasks have a higher priority than any step of the Event Loop. 📌 𝘛𝘩𝘦 𝘳𝘶𝘭𝘦𝘴 𝘰𝘧 𝘵𝘩𝘶𝘮𝘣: ➡️ process.nextTick() is fired before Promises, even if Promise resolved first. ➡️ setImmediate() is always fired after I/O callbacks in the same iteration. ➡️ The order of setTimeout(fn, 0) and setImmediate() is not deterministic outside of I/O callbacks. ➡️ Never use nextTick() recursively in production code. The event loop is why Node.js can handle thousands of simultaneous connections on a single thread. Controlling its execution order is the difference between writing asynchronous code and understanding it. #nodejs #javascript #backend #eventloop #softwareengineering #webdevelopment
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