A mistake I made while working with React. For a long time, I thought more state meant more control. That assumption caused issues later. Here’s what I noticed in real projects: - Components became harder to reason about - Unnecessary re-renders appeared - Debugging took longer than expected What changed my approach: - I questioned whether state was actually needed - I avoided storing derived values - I kept state close to where it’s used One simple rule helped me a lot. If state can be calculated, it probably shouldn’t be stored. How do you decide what truly belongs in state? #react #javascript #frontend #webdevelopment
Azizul Rabby Chowdhury’s Post
More Relevant Posts
-
"useEffect" is one of the most misunderstood hooks in React. Most beginners think it’s for “running code after render” but that mindset causes bugs and unnecessary re-renders. A better way to think about "useEffect" It synchronizes your component with something outside React. Good use cases: Fetching data from an API Subscribing to events Updating document.title Cleaning up listeners Rule of thumb: If your logic doesn’t interact with the outside world, it probably doesn’t belong in "useEffect". Understanding this early makes your React code cleaner, predictable, and easier to maintain. #React #WebDevelopment #Frontend #JavaScript #ReactHooks
To view or add a comment, sign in
-
-
🌱 Going back to basics "Controlled Components" While building forms in React, there is one pattern I keep coming back to "controlled components". At first, I honestly did not like it. "value" here, "onChange" there… feels like too much work. But one thing my mentor said stayed with me : “It is about the mental model. It will help you later.” And slowly, it started making sense....!!! Every input "text box", "dropdown" , "checkbox" takes its value from React state. And every change updates that state. One clear source of truth...!! Simple and predictable. Controlled components may look boring, but they make forms easier to manage when things grow bigger. For me, going back to basics means choosing patterns that keep things clear and easy to reason about. And controlled components do exactly that. #ReactJS #ControlledComponents #Frontend #JavaScript #GoingBackToBasics
To view or add a comment, sign in
-
-
useEffect is one of the most misunderstood hooks in React. It’s not for: • calculating derived values • syncing state with state • fixing re-render issues It is for: • data fetching • subscriptions • timers • syncing with browser or external systems If something can be calculated from existing state or props, it doesn’t belong in useEffect. The less effects you write, the more predictable your React code becomes. #react #frontend #javascript #webdev #cleanCode
To view or add a comment, sign in
-
5 React.js Performance Optimization Techniques I Use on Every Project Code splitting with React.lazy() → Reduces initial bundle size by 40-60% Memoization (useMemo, React.memo) → Prevents unnecessary re-renders Virtual scrolling for large lists → Handles 10K+ items smoothly Debouncing expensive operations → Saves thousands of API calls Bundle size analysis → Catches bloat before production Performance isn't a feature—it's a requirement. Save this for your next optimization sprint! 📌 #ReactJS #WebPerformance #FrontendDevelopment #JavaScript
To view or add a comment, sign in
-
-
One small React mistake that causes big production bugs 🚨 Mistake: Updating state directly. This: state.count = state.count + 1 Causes unexpected behavior and hard-to-track bugs. Correct way: setCount(prev => prev + 1) React depends on immutability. Small mistakes in React can become big production issues. 👉 Beginners, save this post. #ReactJS #JavaScript #Frontend #CodingTips
To view or add a comment, sign in
-
Custom Hooks are one of those React features that can significantly enhance your codebase. If you find yourself duplicating the same useEffect, state, or API logic across components, it's a clear indication that you should create a custom hook. In just three simple steps, you can: • Extract reusable logic • Keep components clean • Improve readability and maintainability This approach scales effectively for real-world applications and simplifies testing and reasoning about your code. Pro tip: If your component is doing too much, it’s likely time for a hook. Save this for later and share it with someone learning React. #ReactJS #FrontendDevelopment #JavaScript #WebDev #ReactHooks #CleanCode #DevCommunity
To view or add a comment, sign in
-
Hot take (but true): React is not hard. JavaScript is. 👍If you don’t understand closures, useDebounce is just copy-paste magic. 👍If you don’t understand reference vs value, your useEffect dependencies will re-run forever and you’ll blame React. 👍If you don’t understand event loop & async behavior, useEffect, promises, and state updates will feel “random”. Most React performance issues are JavaScript knowledge gaps, not React problems. Frameworks don’t replace fundamentals. They amplify them. Learn JavaScript deeply first. React will suddenly feel… simple. #reactjs #javascript #frontend #softwareengineering #careeradvice
To view or add a comment, sign in
-
Hot take (but true): React is not hard. JavaScript is. 👍If you don’t understand closures, useDebounce is just copy-paste magic. 👍If you don’t understand reference vs value, your useEffect dependencies will re-run forever and you’ll blame React. 👍If you don’t understand event loop & async behavior, useEffect, promises, and state updates will feel “random”. Most React performance issues are JavaScript knowledge gaps, not React problems. Frameworks don’t replace fundamentals. They amplify them. Learn JavaScript deeply first. React will suddenly feel… simple. #reactjs #javascript #frontend #softwareengineering #careeradvice
To view or add a comment, sign in
-
How I Understood useCallback At first, useCallback felt useless. My code worked. So why add it? 🤷♂️ Then I learned one thing: 👉 Every render creates a new function. React doesn’t care about logic. It cares about references. useCallback simply tells React: “Please remember this function. Change it only when needed.” That’s it. I now use it mainly when: Passing functions to child components Avoiding unnecessary re-renders Lesson learned 👇 Understand the problem first. The hook will make sense automatically. Still learning. 🚀 #ReactJS #useCallback #FrontendDeveloper #LearningInPublic #Frontend #LearningInPublic #JavaScript #WebDevelopment #DeveloperJourney
To view or add a comment, sign in
-
-
React Performance isn’t about adding hooks everywhere. It’s about adding them where they matter. Most applications suffer from unnecessary re-renders and unstable references. Two small hooks. Massive impact: 1. useCallback → Stabilize function references 2. useMemo → Avoid expensive recalculations But misuse them, and you just add complexity with zero gains #ReactJS #NextJS #FrontendDevelopment #WebPerformance #JavaScript #SoftwareEngineering #ReactPerformance #Optimization #CleanCode #TechLeadership #UIDevelopment #ProgrammingTips
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