⚡ A small Promise.all detail that can break your app Promise.all looks simple. Run multiple async tasks → get all results. But here’s the catch 👇 ❌ If even one promise fails, everything fails So even if 2 APIs succeed and 1 fails… you get nothing 😬 This hit me in a real project 👇 One non-critical API failed, and the entire page broke 💥 What I do now: ✅ Use Promise.all only when all results are required ✅ Use Promise.allSettled when partial data is acceptable Because sometimes… 👉 Partial data > No data Small detail. Real impact. #JavaScript #FrontendDevelopment #WebDevelopment #AsyncJS #SoftwareEngineering
Promise.all pitfalls in JavaScript development
More Relevant Posts
-
Most React apps don’t feel slow because of React. They feel slow because of THIS mistake 👇 Developers run expensive calculations on every render. It looks harmless. But behind the scenes: → It runs again → And again → And again Silent performance killer ⚠️ The fix? useMemo. Run it only when data changes. Not everything should run on every render. Smart dev writes code. Great dev controls renders. Are you making this mistake?
To view or add a comment, sign in
-
-
⚠️ This AsyncStorage mistake can silently break your React Native app… Think you’re handling storage correctly? Try this 👇 👉 Which pattern is WRONG? A️ await AsyncStorage.setItem('user', JSON.stringify(user)); B️ const user = await AsyncStorage.getItem('user'); console.log(JSON.parse(user)); C️ AsyncStorage.setItem('token', token); D️ const data = AsyncStorage.getItem('key'); console.log(data); 💥 Correct Answer: D You’re logging a Promise, not the actual value. AsyncStorage is asynchronous. If you skip await, your data isn’t ready when you use it. 🧠 Fix: const data = await AsyncStorage.getItem('key'); 🚫 Common impact: • Random UI bugs • Data mismatch • Debugging nightmares 💬 Be honest — have you made this mistake before? 🔁 Follow for daily React Native insights that actually matter. #ReactNative #JavaScript #AsyncStorage #MobileDev #Debugging #Frontend #CodingMistakes #LearnToCode #DevTips
To view or add a comment, sign in
-
-
🚀 Why Your React App Feels Slow (Even If Your Code Looks Fine) You check your code. Everything looks clean. No errors. No warnings. But still… the app feels slow. I’ve faced this in real projects — and the issue is rarely “bad code”. It’s usually hidden performance mistakes 👇 🔹 Too many unnecessary re-renders → Components updating even when data hasn’t changed 🔹 Large components doing too much → One component = multiple responsibilities 🔹 No memoization → Missing React.memo, useMemo, useCallback where needed 🔹 Heavy API calls without optimization → No caching, no batching, no proper loading handling 🔹 Poor state management → Global state changes triggering full re-renders 🔹 No code splitting → Loading everything at once instead of lazy loading 🔹 Unoptimized lists → Rendering large lists without virtualization 💡 What actually improved performance for me: ✔ Breaking components into smaller units ✔ Using memoization strategically (not everywhere) ✔ Lazy loading routes & components ✔ Optimizing API calls (RTK Query caching helped a lot) ✔ Avoiding unnecessary state updates 📌 Reality: Performance issues don’t show in small apps… They appear when real users start using your product. Clean code is good. But optimized code is what users feel. 💬 What’s one performance issue you faced in React? #ReactJS #FrontendPerformance #WebDevelopment #JavaScript #SoftwareEngineering #CleanCode
To view or add a comment, sign in
-
-
🚨 Why Your Node.js App Slows Down Over Time (Hidden Memory Leaks) If your Node.js app starts fast but gets slower over time… you might have a memory leak. 👉 This is a senior-level issue most developers ignore. 🔍 Common causes: ❌ Unremoved event listeners ❌ Global variables growing over time ❌ Caching without limits ❌ Open database connections ❌ setInterval / setTimeout not cleared 💡 Example mistake: Adding event listeners inside a request handler app.get("/", (req, res) => { process.on("event", () => {}) // ❌ memory leak }) Every request adds a new listener → memory keeps increasing 💡 Fix: ✔ Remove listeners when not needed ✔ Use weak references where possible ✔ Monitor memory usage (heap snapshots) ✔ Use tools like: Chrome DevTools clinic.js ⚡ Senior Rule: “If memory keeps growing, your app will eventually crash — it’s just a matter of time.” Don’t just fix bugs… prevent system failure. #nodejs #backend #memoryleak #performance #javascript #webdev #fullstackdeveloper #debugging
To view or add a comment, sign in
-
Today was about stabilizing the "front door" of the app: the Login flow and its connection to Redux. TrackMate needed a reliable way to move from a successful API response to a fully authenticated state that persists across app restarts. Refined the Login Thunk → mapped backend data directly to the Redux state. Fixed Keychain storage crash → ensured the refresh token is passed as a validated string to prevent native-side errors. Synchronized User Profiles → verified that ID, Name, and Profile Picture are correctly stored in the global state. Resolved "Undefined" UI colors → restored the primary theme constants for the Login button states. The real engineering insight today: Passing an object when a native module expects a string will crash your bridge every time. In React Native, keychain.setGenericPassword is a non-null host function; if your Redux selector or Thunk passes undefined during a state transition, the app doesn't just fail—it closes. Always validate your token types before they hit the storage layer. Stack: React Native, Redux Toolkit, Node.js Day 18/30. If anyone has pointers on handling token expiration gracefully in Redux middleware, let me know. #buildinpublic #nodejs #reactnative #javascript #softwaredevelopment
To view or add a comment, sign in
-
Day 19 #100DaysOfCode 💻#Extra Today I learned how to fetch data in Next.js using async Server Components. In Next.js App Router, we can directly use async/await inside components. No need for useEffect or extra state handling. This makes data fetching cleaner and faster. Example: const UsersPage = async () => { const res = await fetch('https://lnkd.in/gc6VE9Hi'); const users = await res.json(); return ( <div> {users.map(user => ( <p key={user.id}>{user.name}</p> ))} </div> ); }; Simple, clean, and powerful way to handle data in modern React 🚀 #NextJS #ReactJS #WebDevelopment #FrontendDeveloper #LearningInPublic #Akbiplob
To view or add a comment, sign in
-
Handling errors individually in every route is repetitive and inconsistent. A centralized error handler fixes that: ```js // utils/AppError.js class AppError extends Error { constructor(message, statusCode) { super(message); this.statusCode = statusCode; this.isOperational = true; } } // In your routes — throw errors cleanly app.get('/users/:id', asyncHandler(async (req, res) => { const user = await User.findById(req.params.id); if (!user) throw new AppError('User not found', 404); res.json(user); })); // Global error handler — one place for everything app.use((err, req, res, next) => { const statusCode = err.statusCode || 500; const message = err.isOperational ? err.message : 'Internal server error'; res.status(statusCode).json({ status: 'error', message }); }); ``` Consistent error responses make your API easier to consume and your codebase easier to maintain. #NodeJS #ExpressJS #BackendDevelopment #BestPractices
To view or add a comment, sign in
-
Hot take: WebAssembly for compute-heavy web apps — real-world use cases is changing faster than most teams can adapt. Here's what I've seen work in production: 1. Start small — prototype with the simplest approach first 2. Measure before optimizing — gut feelings are usually wrong 3. Invest in developer experience — fast feedback loops compound The teams that ship fastest aren't using the newest tools. They're using the right tools for their specific constraints. What's your experience been? Drop a comment below. #WebDevelopment #TypeScript #Frontend #JavaScript
To view or add a comment, sign in
-
Most Confusing Concepts in React: useCallback vs useMemo! Many developers get confused between these two hooks, but the difference is simple once you see the code. Use useCallback when you want to cache a function itself so it doesn't change on every render. Use useMemo when you want to cache the result (value) of a function to avoid heavy calculations. Mastering these will make your React apps much faster and more professional.
To view or add a comment, sign in
-
-
You've probably used an app where.... checking a checkbox checked the wrong item. You clicked one thing.... And something completely different responded. It felt like a glitch 🥴. Like the app lost track of itself. What actually happened was React lost track of identity. Because nobody gave the list items a stable, unique key. React uses keys to match elements between renders. Without stable keys, it can’t reliably tell which item is which, so it ends up reusing the wrong component instances. Sometimes it works. Sometimes, a component state like a checked checkbox or input value sticks to the wrong item. That disorienting feeling of an app that can't keep track of its own data That's React trying to reconcile a list without a stable identity. 🔴 𝗪𝗵𝗮𝘁 𝘁𝗵𝗲 𝗰𝗼𝗱𝗲 𝗹𝗼𝗼𝗸𝘀 𝗹𝗶𝗸𝗲: ``` {posts.map((post, index) => ( <PostCard key={index} post={post} /> ))} ``` Using an index as a key breaks when items are added, removed, or reordered. React sees the same keys associated with different items and reuses the wrong component instances. 🟢 𝗧𝗵𝗲 𝗳𝗶𝘅: ``` {posts.map((post) => ( <PostCard key={post._id} post={post} /> ))} ``` Give every item a stable, unique identity. React uses the key to track what changed not where it sits in the array. Have you ever run into a bug like this in production? What did it look like? Drop it below 👇 Follow for more React concepts explained simply #reactjs #webdevelopment #javascript
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