🚨 The React mistake that causes multiple API requests You only call your API once. But when you check the network tab… You see 3–4 API requests. What happened? A very common cause is React Strict Mode in development. Example: useEffect(() => { fetch("/api/products") }, []) You expect the API to run once. But in development, React may run the effect twice. Result: ❌ Duplicate API requests ❌ Confusing debugging ❌ Developers think their code is wrong Why does React do this? React Strict Mode intentionally runs effects twice in development to detect side effects. This helps identify bugs early. But it also surprises many developers. Important: This only happens in development, not in production. 💡 If you see duplicate API calls while debugging, check if StrictMode is enabled. Good React engineers understand how React behaves in development vs production. #reactjs #frontend #javascript #webdevelopment #softwareengineering
React Strict Mode causes duplicate API requests in development
More Relevant Posts
-
Most React developers write a lot of tests. But still ship bugs. The problem isn't the number of tests — it's what they're testing. Early on, I used to test internal state and function calls. Looked fine. Until I refactored — and suddenly 10 tests broke, even though the UI worked perfectly for the user. That's when I realised: I was testing the code, not the experience. The shift that changed everything → (see images) 3 things worth actually testing in React: → User behaviour — clicks, inputs, submissions → Edge cases — empty, error, and loading states → Pure logic — validators, formatters, transformers The rule I follow now: If a test breaks after refactoring but the UI still works — the test was wrong, not the refactor. Tests are a contract with the user. Not with your implementation. What's the most useless test you've seen in a codebase? 👇 #React #ReactJS #JavaScript #TypeScript #Frontend #WebDevelopment #SoftwareEngineering #Testing #CleanCode #NextJS
To view or add a comment, sign in
-
⚛️ The Big Mistake React JS Developers Make 🚨 Most developers jump straight into building features… But ignore one critical thing 👇 ⚠️ Project Structure When your file structure is messy: • Components become hard to manage • Debugging turns into a headache • Reusability drops • Scaling becomes difficult 💡 “Spaghetti components” = Confusion + Bugs 🔥 The right approach: ✔️ Organize folders logically ✔️ Keep components small & reusable ✔️ Separate concerns (UI, logic, services) ✔️ Follow clean architecture ⚡ Remember: Good code is not just about making it work… It’s about making it scalable, readable, and maintainable 🚀 Fix your project structure, level up your development game #ReactJS #CleanCode #FrontendDevelopment #WebDevelopment #Developers #CodingTips
To view or add a comment, sign in
-
-
🚀 Building with React: Lessons from Real Projects. Working with React has taught me that building modern applications is not just about designing interfaces it’s about managing data flow, scalability, and performance. Through hands-on experience with React, Redux, and API integration, I’ve learned the importance of: ✔ Creating reusable and modular components ✔ Managing application state efficiently with Redux ✔ Handling API calls and asynchronous data effectively ✔ Maintaining clean and scalable project structures These practices not only improve the performance of an application but also make it easier for teams to collaborate and maintain the codebase. Frontend development continues to evolve rapidly, and it’s exciting to keep learning and building solutions that create real impact. #ReactJS #Redux #FrontendDevelopment #JavaScript #SoftwareEngineering
To view or add a comment, sign in
-
React isn’t just a library—it’s a mindset. From breaking down complex UIs into reusable components to managing state with precision, React teaches you how to think in systems, not just screens. What looks like simple code on the surface is actually layers of logic, structure, and scalability working together behind the scenes. Just like any powerful tool, the real value of React isn’t in writing code—it’s in how you architect experiences. Build components. Think in flows. Design for scale. #ReactJS #FrontendDevelopment #WebDevelopment #JavaScript #SoftwareEngineering
To view or add a comment, sign in
-
-
🚨 90% of React developers use Hooks daily... Very few truly understand when to use which one. Hooks are powerful—but misusing them leads to unnecessary re-renders, performance issues, and hard-to-maintain components. The difference between average and strong React developers is not syntax—it’s 𝗱𝗲𝗰𝗶𝘀𝗶𝗼𝗻-𝗺𝗮𝗸𝗶𝗻𝗴. 👇 Here’s a simplified mental model I follow: ⚡ `𝘂𝘀𝗲𝗦𝘁𝗮𝘁𝗲` → local state management ⚡ `𝘂𝘀𝗲𝗘𝗳𝗳𝗲𝗰𝘁` → side effects (API calls, subscriptions) ⚡ `𝘂𝘀𝗲𝗥𝗲𝗳` → persistent values without re-render ⚡ `𝘂𝘀𝗲𝗠𝗲𝗺𝗼` → optimize expensive calculations ⚡ `𝘂𝘀𝗲𝗖𝗮𝗹𝗹𝗯𝗮𝗰𝗸` → stabilize function references ⚡ `𝘂𝘀𝗲𝗖𝗼𝗻𝘁𝗲𝘅𝘁` → share global state ⚡ `𝘂𝘀𝗲𝗥𝗲𝗱𝘂𝗰𝗲𝗿` → manage complex state logic ⚡ `𝘂𝘀𝗲𝗟𝗮𝘆𝗼𝘂𝘁𝗘𝗳𝗳𝗲𝗰𝘁` → run before paint (use carefully) ⚡ `𝘂𝘀𝗲𝗧𝗿𝗮𝗻𝘀𝗶𝘁𝗶𝗼𝗻` / `𝘂𝘀𝗲𝗗𝗲𝗳𝗲𝗿𝗿𝗲𝗱𝗩𝗮𝗹𝘂𝗲` → keep UI responsive under load Most performance issues come from overusing hooks—not understanding them. 👇 Practical rules I apply: * Don’t use `useMemo` or `useCallback` unless there’s a measurable need * Keep `useEffect` clean and avoid unnecessary dependencies * Prefer simple state (`useState`) before reaching for complex patterns Hooks are not shortcuts—they’re tools. Used correctly, they make your UI fast and predictable. Save this before you miss out. This cheat sheet can save you hundreds of hours. ⏳ Which hook do you think is most misunderstood in real-world projects? #ReactJS #ReactNative #FrontendEngineering #WebPerformance #JavaScript #CleanCode #SoftwareEngineering #UIEngineering
To view or add a comment, sign in
-
-
Most React developers use this pattern every day: setCount(prev => prev + 1) But very few can clearly explain why it’s necessary. In React, state updates are not immediate. They can be batched and executed later, which means the value you’re using (count) might already be outdated when the update actually runs. The functional update avoids this problem. Instead of relying on a potentially stale value, it receives the latest state at the exact moment React processes the update. So instead of saying: “set the value to this” you’re saying: “update based on whatever the current value is” That’s the key difference. This pattern isn’t just syntax, it’s how you avoid subtle bugs when your next state depends on the previous one. #React #JavaScript #Frontend #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
🚀 Day 23/30 – React Best Practices Most React developers don’t struggle with syntax… 👉 They struggle with writing maintainable code 👀 Today I focused on what actually makes code production-ready ⚡ 💡 What I realized: Clean code is not about making things “look good” 👉 It’s about making code easy to understand, scale, and debug 💻 Practices I’m following: ✅ Keep components small & focused → One component = one responsibility ✅ Use meaningful names → Code should explain itself (no comments needed) ✅ Avoid prop drilling → Use Context when data goes deep ✅ Reuse logic with custom hooks → Don’t repeat yourself ✅ Separate business logic from UI → Components should focus on rendering ✅ Handle loading & errors properly → Real apps are not always “happy path” 🔥 Reality Check: 👉 Messy code works… until it doesn’t 👉 Clean code scales… messy code breaks ⚡ Advanced Insight: Senior developers don’t write “clever” code 👉 They write predictable, readable code 🔥 Key Takeaway: Anyone can write code that runs 👉 Not everyone writes code that lasts Be honest 👇 Would another developer understand your code in 30 seconds? 👀 #React #CleanCode #FrontendDevelopment #JavaScript #BestPractices
To view or add a comment, sign in
-
-
🚀 Starting a 10-part series on React things that make code harder than it needs to be. Not tutorials. Not “10 hooks you should know.” Just real patterns that show up in actual codebases and make simple work more annoying than it should be. Part 1: A lot of React problems are really state problems. Not React itself. Not JSX. Not even hooks most of the time. State living in too many places. Duplicated state. State doing jobs it was never supposed to do. That’s usually when an app starts feeling harder to reason about than it should. The more I work with React, the more I think good frontend code starts with good state decisions. If the state is messy, everything downstream gets harder: debugging feature work testing handoffs even basic collaboration Good React usually feels predictable. And predictable usually starts with state. What’s the most common state mistake you keep seeing? #React #ReactJS #StateManagement #FrontendEngineering #JavaScript #TypeScript #SoftwareEngineering
To view or add a comment, sign in
-
Most React Developers Don’t Struggle With Syntax… They Struggle With Clarity While building projects, I kept running into the same issue Not big bugs… just small confusions again and again When to use useEffect Why unnecessary re-renders happen How state actually flows across components So I did something simple I created a React Cheatsheet for myself Not theory-heavy Just the things I actually use while building: ⚡ Core concepts → Components, JSX, Virtual DOM ⚡ Hooks → useState, useEffect, useContext ⚡ Routing, Forms, API integration ⚡ Performance basics & clean practices ⚡ Testing + small project ideas This isn’t “everything about React” It’s what actually helps when you're in the middle of building And honestly, that’s what matters most If you're working with React, this might help you too Comment “React” and I’ll share it 👇 #ReactJS #Frontend #WebDevelopment #JavaScript #Developers #LearningInPublic
To view or add a comment, sign in
-
-
Most developers get React wrong from the start. Not the syntax. Not the logic. The architecture. After 4+ years and multiple production apps, here are 5 mistakes I see constantly: 1. Putting everything in one component → Break it down. Small components = readable code = easy debugging. 2. Fetching data inside components instead of custom hooks → Separation of concerns isn't optional. It's survival. 3. Ignoring performance until it's a problem → useMemo and useCallback aren't premature optimization. They're planning ahead. 4. Skipping TypeScript "to save time" → TypeScript saves you 10x more time in debugging than it costs in setup. 5. Not thinking about mobile first → In 2026, if it doesn't work on mobile, it doesn't work. Period. Which one did you learn the hard way? Save this for your next code review 🔖 #ReactJS #FrontendDevelopment #JavaScript #WebDev #CodeQuality
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
This confused me the first time I saw duplicate API calls in the network tab. Good reminder that StrictMode behaves differently in development and can save a lot of unnecessary debugging.