🎉 Just released a tiny one I've been using internally @mateosuarezdev/attempt - an utility for explicit error handling in TypeScript. Tired of nested try-catch blocks? This library treats errors as values, not exceptions, making your code cleaner and safer: ✨ No try-catch boilerplate ✨ Explicit error handling with TypeScript type inference ✨ Array destructuring for flexible variable naming ✨ Works with custom error types across your app ✨ Supports both sync and async operations Perfect for DB Queries, API calls, JSON parsing, or any operation where you want predictable error handling. Built as a standalone package after extracting the pattern from my apps. Get started: npm install @mateosuarezdev/attempt yarn/pnpm/bun add @mateosuarezdev/attempt Repo: https://lnkd.in/dsVrK7Yb Check it out and let me know what you think! #typescript #javascript #trycatch #errors #bun #node #react
Released attempt, a TypeScript library for explicit error handling
More Relevant Posts
-
Ever had a React component get stuck in an infinite re-render loop? It happened to me last week. I was debugging a simple data-fetching component, but my network tab was exploding with requests. 🔥 The culprit was a sneaky `useEffect` dependency. The hook’s dependency array included a function `fetchData` that was defined right inside the component body. On every single render, React was creating a 𝐧𝐞𝐰 instance of that function. This new reference would trigger the `useEffect` all over again. It’s a classic trap that's surprisingly easy to fall into. 🧠⚡ The fix was simple: wrapping the function in `useCallback` to memoize it. Have you struggled with this before? #ReactJS #FrontendDevelopment #DeveloperTips
To view or add a comment, sign in
-
🧩 React Redux Toolkit — A Beginner’s Guide (Modern Redux Explained Clearly) Learn Redux Toolkit (RTK) — the official, modern way to manage global state in React, with minimal boilerplate and clear structure. Redux is a predictable state container for JavaScript applications. centralized store. You can use it with React, Vue, Svelte, or even plain JavaScript. Feature Context API Redux Toolkit Purpose Pass data down the component tree Manage global, shared state predictably Scalability Good for small/medium apps Ideal for complex, multi-team apps Performance Can cause unnecessary re-renders Optimized updates using selectors Debugging No time travel/debug tools Redux DevTools (history, diffs, time travel) Structure Unopinionated Enforces clear modular structure 💡 Use Redux when your app needs: Complex state logic (user, theme, notifications, API data) Predictable updates and debugging Collaboration across large teams Middleware or async logic (API handling) Single source of truth (one global store) Predictable state updates (reducers) Middlewar https://lnkd.in/gHMzqMpW
To view or add a comment, sign in
-
🚀 Exploring React + Redux — mastering state management the right way! React helps build powerful UIs, but when the app grows, managing shared state can get tricky. That’s where Redux comes in — providing a predictable, centralized state container that keeps the data flow clean and consistent. ✅ Actions → Reducers → Store → UI — simple yet powerful architecture. Loving how Redux makes debugging easier (thanks to Redux DevTools) and how middleware like Redux Thunk simplifies asynchronous logic. #ReactJS #Redux #FrontendDevelopment #WebDevelopment #JavaScript #StateManagement #LearningJourney #bridgeon
To view or add a comment, sign in
-
-
React Context vs. Redux: Stop Over-Engineering Your State! Choosing the right state management tool is not about "which is better," but "which is right for my app's complexity." This simple chart explains the core trade-off: 🟢 React Context API: Your go-to for simple data that changes infrequently (like a UI theme or user profile). It's built-in and easy to start, but its re-render mechanism can hurt performance on frequently changing data. 🔴 Redux (with RTK): Necessary for large, complex apps with data that changes frequently. It’s more boilerplate, but the use of Selectors gives you highly optimized performance and DevTools provide unmatched debugging power. The Takeaway: Start with Context. Only move to Redux when you face performance bottlenecks or need its advanced debugging and middleware features. Which one do you rely on for your current project? Let me know in the comments! 👇 #ReactJS #Redux #ContextAPI #FrontendDevelopment #JavaScript #WebDevelopment
To view or add a comment, sign in
-
-
Ever added custom properties to the request object in Express — only to realize that TypeScript doesn’t recognize them? 😅 Your app runs perfectly fine, but you lose all that sweet IntelliSense and type safety that TypeScript promises. In this video, I’ll walk you through how to properly extend the native Express Request object so TypeScript knows about your custom properties — giving you full autocomplete and error checking in your code. 💪 If you’ve ever done something like req.user = ... or req.sessionData = ... in your middleware and wondered why TypeScript doesn’t get it — this one’s for you! #TypeScript #ExpressJS #NodeJS #BackendDevelopment #WebDevelopment #Coding #SoftwareEngineering #JavaScript #TypeSafety
To view or add a comment, sign in
-
Excited about the future of React! 🚀 React 19 is bringing a major update, and it's all about simplifying our code and boosting performance. The biggest news is the new React Compiler, which automatically optimizes your app. This means we can finally say goodbye to manual memoization! 👋 Here are the key highlights: ✨ Automatic Memoization: No more useMemo, useCallback, or memo. The compiler handles it for you. 🗑️ No More forwardRef: You can now pass ref as a prop directly. 🚀 The use Hook: A powerful, single hook to replace useEffect for data fetching (with Suspense) and useContext for reading context. 🎬 Server/Client Actions: A streamlined way to handle form submissions on both the client and server. ⏳ useFormStatus & useFormState: New hooks to easily manage form pending states and responses. ⚡ useOptimistic Hook: Instantly update the UI for a super-responsive feel while waiting for the server response. This update is a huge step forward for developer experience and app performance! Want the 8-minute breakdown? Check out the full video #React #React19 #JavaScript #WebDevelopment #Frontend #Programming #ReactJS #TechUpdate #Developer https://lnkd.in/dQmnXaeY
Every React 19 Feature Explained in 8 Minutes
https://www.youtube.com/
To view or add a comment, sign in
-
Most developers pick Redux for everything. I used to be one of them. After 47 React projects, here's when I actually use each: Context API wins when: • Team has 3 or fewer developers • App state fits in 2-4 contexts max • You need something working in 30 minutes • No complex async operations Redux wins when: • Team has 5+ developers • You need time travel debugging • Complex state logic spans multiple components • Heavy async with middleware needs The real mistake? Forcing Redux into every project because it feels "professional." I've seen 3-person teams spend 2 weeks setting up Redux for a simple dashboard that Context API could handle in 1 afternoon. Your tool choice should match your complexity, not your ego. What's your go-to method for deciding between state management approaches? #ReactJS #WebDevelopment #JavaScript #TechTrends #SoftwareDevelopment #ProgrammingTips #Rankue #Vonyex
To view or add a comment, sign in
-
💡 From Vanilla JS → React → Redux Toolkit: Full Circle Moment This week I have been exploring Redux Toolkit and had a fun realisation. In React, we never mutate state and always return new objects with useState. Then with Redux Toolkit, I wrote this: state.push(action.payload) …and it just worked. Why? Immer handles immutability under the hood. It lets us write “mutating” code while keeping state updates safe and predictable. Feels like a full circle: from mutating in vanilla JS → immutable in React → “mutating safely” in Redux Toolkit. ✅ Lesson: Redux Toolkit makes state management clean, simple, and safe. #React #ReduxToolkit #JavaScript #WebDev #StateManagement
To view or add a comment, sign in
-
🎯 React Context API — Share Data Across Components Easily! Ever struggled to pass props between multiple components? That’s where React Context API comes in — it lets you share data globally without prop-drilling. Here’s the full example 👇 ✅ Step 1 – Create and Use Context 🧩 Step 2 – Use It in Another Component ⚡ Step 3 – Include It in Your Main App 💡 How It Works createContext() → Creates a shared data space <UserContext.Provider> → Broadcasts the value to all children useContext(UserContext) → Reads the shared value anywhere inside Without the <Provider>, components will get undefined — because there’s no “signal” being sent 📡 🔥 Key Takeaway: React Context is your built-in global state manager — no extra libraries, no prop chaos! #ReactJS #ContextAPI #JavaScript #FrontendDevelopment #WebDevelopment #ReactTips #LearnCoding
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