This week I didn't just learn React. I made it prove itself to me. Every hook. Every concept. One mini project at a time. 🔥 Here's how it went: useState → built a Counter (okay why do I even need this... oh. OH. the page re-renders. got it.) useEffect → built a Background Color Changer (so this runs AFTER render... and I control when... nice) useCallback → built a Password Generator (wait so without this it was recreating the function every render? that's wild) useRef → built a Stopwatch (persists between renders but doesn't cause one. the quiet one of the family) Custom Hooks → built a Github Profile Generator (this is just... extracting logic into a function? and it works? okay React you're cool) useContext → no more prop drilling. finally. State Lifting → data flows up before it flows down. the mindset shift. Routing → multiple routes, dynamic routes, nested routes. React Router clicked. This is what the learn-and-build strategy actually feels like. You don't understand a hook by reading about it. You understand it when your mini project breaks without it. That's when it stops being syntax and starts being instinct. Next week — Redux Toolkit and starting with backend. The stack is coming together. One week at a time. 🚀 What did YOU build when you first learned React? Drop it below 👇 #ReactJS #WebDevelopment #JavaScript #LearnInPublic #FrontendDevelopment #100DaysOfCode #BuildInPublic #TechJourney #Redux
React Hooks in Practice: Building Mini Projects
More Relevant Posts
-
Real talk — useEffect almost broke my brain today. 😅 My React journey continues, and I came across one of the trickiest hooks so far. useEffect. At first I felt completely lost. The Codecademy lesson talked about cleanup functions, dependency arrays, side effects — and honestly? My head was spinning. But after stepping back and breaking it down in simpler terms, here's what finally made sense to me: useEffect lets you run code at SPECIFIC MOMENTS in your component's life. Three moments to remember: ```jsx // 1. Run AFTER EVERY render useEffect(() => { }); // 2. Run ONLY ONCE when the page loads useEffect(() => { }, []); // 3. Run WHEN a specific value changes useEffect(() => { }, [forecastType]); ``` The array at the end is called the dependency array — and it controls WHEN the code runs. The analogy that helped me? Think of it like a home security camera 📹 - No array — records 24/7 - Empty array — only records on day one - With a value — only records when that thing changes It's still not 100% clear to me yet — and that's okay. Some concepts take time to really click. 🙏 The lesson today wasn't just about useEffect though — it was about being honest with myself when something is hard, taking a break, and coming back to it instead of forcing it. Still learning, still building, still showing up every day. 💪 Is there a React concept that confused you when you first learned it? Drop it below 👇 #React #JavaScript #useEffect #Frontend #LearningInPublic #100DaysOfCode #SelfTaught
To view or add a comment, sign in
-
😵💫 “Why is my setTimeout running AFTER my Promise?” This question confused me for a long time while working with JavaScript. I thought: 👉 setTimeout(0) = runs immediately 👉 Promise = async → should run later But I was WRONG. I tested this 👇 console.log("Start"); setTimeout(() => console.log("Timeout"), 0); Promise.resolve().then(() => console.log("Promise")); console.log("End"); 👉 Output shocked me: Start → End → Promise → Timeout Then I saw this diagram 👇 …and everything clicked. 💡 The truth: JavaScript doesn’t just run “async code” randomly. It follows a strict priority system: ⚡ Microtasks (Promises) → HIGH priority ⏳ Macrotasks (setTimeout) → LOW priority 🔄 What actually happens: Run all sync code → Start, End Clear Microtask Queue → Promise Then Macrotask Queue → Timeout 🔥 The moment I understood this: Debugging async code became 10x easier No more guessing execution order My React apps felt more predictable 📌 One line to remember: 👉 “Promises beat setTimeout. Always.” If you’re learning frontend, this is one concept you can’t ignore. What was your “wait… what?!” moment in JavaScript? 👇 #JavaScript #FrontendDevelopment #Coding #WebDevelopment #LearnInPublic
To view or add a comment, sign in
-
-
React journey continues — and today's lesson was all about Components. 🧱 A few days ago I talked about JSX. Then the DOM and Virtual DOM. Today? Components made my brain light up in the best way. Here's what I learned: A component is just a JavaScript function that returns JSX. That's it. ```jsx function AnimalFacts() { return <p>Fun fact about animals!</p>; } ``` But what surprised me the most? You can use it like an HTML tag: ```jsx <AnimalFacts /> ``` That one line renders your entire component. Mind = blown. 🤯 The analogy that made it all click for me? LEGO bricks 🧱 Each component is its own brick — built separately, snapped together to make something bigger. And the best part? They're REUSABLE. One component can work for a dolphin, a lobster, and a starfish! Self taught, learning in public, and taking it one concept at a time. 💪 If you're on a similar journey, let's connect! And if you're experienced — what's YOUR favourite analogy for explaining components? Drop it below 👇 #React #JavaScript #Frontend #Components #LearningInPublic #100DaysOfCode #SelfTaught
To view or add a comment, sign in
-
-
Most React tutorials show basic folder structures—but real-world projects need something more scalable. Here’s the approach I follow to keep my projects clean and production-ready: 🔹 I separate logic by features, not just files 🔹 Keep components reusable and independent 🔹 Move all API logic into services (no messy calls inside components) 🔹 Use custom hooks to simplify complex logic 🔹 Maintain global state with Context or Redux only when needed 🔹 Keep utilities and helpers isolated for better reuse 💡 The goal is simple: Write code today that’s easy to scale tomorrow. As projects grow, structure becomes more important than syntax. What’s your approach—feature-based or file-based structure? 👇 Follow me - Abhishek Anand 😍 #share #like #repost #ReactJS #FrontendDevelopment #MERNStack #CleanCode #WebDevelopment #Javascript Credit #jamesCodeLab
To view or add a comment, sign in
-
-
💻 5 React mistakes I stopped making (and it improved my code a lot) When I started with React, I used to write code that worked… But not code that was clean, scalable, and maintainable. Here are 5 mistakes I fixed: ❌ 1. Writing everything in one component 👉 Now I break UI into small reusable components ❌ 2. Ignoring proper state management 👉 Learned when to use useState vs useEffect vs lifting state ❌ 3. Not handling performance 👉 Started using memoization (useMemo, useCallback) ❌ 4. Poor folder structure 👉 Now I follow a clean project structure ❌ 5. Debugging randomly 👉 Now I debug step-by-step with proper logs Small changes… but huge difference in code quality 🚀 Still learning every day 👨💻 Which mistake did you make the most? 😅 #ReactJS #FrontendDevelopment #JavaScript #CleanCode #WebDevelopment #SoftwareEngineer
To view or add a comment, sign in
-
Spent today diving deep into some of the most crucial concepts in JavaScript and frontend development. Building interactive applications requires a solid understanding of how the browser manages events and data, and today's session covered exactly that. Here are the key takeaways from today's learning: 𝐇𝐢𝐠𝐡𝐞𝐫-𝐎𝐫𝐝𝐞𝐫 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐬: Explored how to write cleaner, more declarative code using functions that accept other functions as arguments or return them (like map, filter, and reduce). 𝐅𝐨𝐫𝐦 𝐇𝐚𝐧𝐝𝐥𝐢𝐧𝐠: Looked into best practices for capturing, validating, and managing user inputs efficiently within the DOM. 𝐃𝐎𝐌 𝐄𝐯𝐞𝐧𝐭 𝐇𝐚𝐧𝐝𝐥𝐢𝐧𝐠: Broke down the mechanics of user interactions and how the browser listens for and responds to them. 𝐄𝐯𝐞𝐧𝐭 𝐏𝐫𝐨𝐩𝐚𝐠𝐚𝐭𝐢𝐨𝐧 (𝐁𝐮𝐛𝐛𝐥𝐢𝐧𝐠 & 𝐂𝐚𝐩𝐭𝐮𝐫𝐢𝐧𝐠): Mapped out the exact journey of an event—from the window down to the target element (capturing) and back up the DOM tree (bubbling). 𝐄𝐯𝐞𝐧𝐭 𝐃𝐞𝐥𝐞𝐠𝐚𝐭𝐢𝐨𝐧: Learned how to optimize performance and write cleaner code by attaching a single event listener to a parent element rather than binding multiple listeners to individual child nodes. Mastering these core mechanics is definitely a game-changer for writing scalable and performant frontend code. Looking forward to implementing these patterns in my upcoming web projects! #JavaScript #FrontendDevelopment #WebDevelopment #DOM #SoftwareEngineering #CodingJourney
To view or add a comment, sign in
-
I spent 3 months confused by React. Then I learned Hooks — and everything finally clicked. Most tutorials throw you into class components and lifecycle methods. It's overwhelming. But Hooks changed everything — they made React actually fun to write. Here's the complete mental map I wish I had on day one: ⚡ useState — add local state to any function component ⚡ useEffect — handle side effects (API calls, subscriptions) 🔵 useRef — access DOM elements & persist values without re-rendering 🔵 useContext — share data across the component tree 🟡 useMemo — cache expensive calculations 🟡 useCallback — memoize functions to prevent unnecessary re-renders 🟢 useReducer — manage complex state with reducer logic 🟢 useLayoutEffect — like useEffect, but fires before paint 5 tips to go from beginner → advanced: Master useState & useEffect DEEPLY before moving on Build custom hooks — extract logic you reuse (e.g. useWindowSize) Think in data flow — hooks work best when you understand how state moves Optimize wisely — reach for useMemo/useCallback only when you actually need them Keep building. Real projects teach what tutorials can't. Hooks aren't just syntax — they're a new way of thinking about UI logic. If you're just starting out: be patient with yourself. The mental model takes time. Once it lands, you'll wonder how you ever coded without them. Save this post — it'll make sense in ways it doesn't yet. 🔖 Which Hook was the hardest for you to wrap your head around? Drop it below 👇 #ReactJS #WebDevelopment #JavaScript #Frontend #ReactHooks #Coding #LearnToCode #SoftwareEngineering #100DaysOfCode
To view or add a comment, sign in
-
-
Most React devs use hooks daily… But a lot of us are using them wrong (or at least inefficiently). Here are 5 React Hooks you're probably misusing 👇 1. useEffect: Doing too much If your useEffect looks like a mini backend service… that’s a red flag. 👉 Keep it focused: one responsibility per effect. 👉 Avoid unnecessary dependencies (or missing ones 😬). 2. useState: Over-fragmenting state Multiple useState calls for tightly related data = messy logic. 👉 Consider grouping related state into one object 👉 Or use useReducer for complex flows 3. useMemo: Premature optimization Not everything needs memoization. 👉 If your calculation is cheap, skip it 👉 Overusing useMemo can hurt readability more than it helps performance 4. useCallback: Blind usage Wrapping every function in useCallback ≠ optimization 👉 Only use it when passing functions to memoized components 👉 Otherwise, you're just adding complexity 5. useRef: Misunderstood power It’s not just for DOM access 👉 Great for persisting values without re-renders 👉 Perfect for timers, previous values, or mutable variables 💡 Rule of thumb: If you can’t clearly explain why you're using a hook… you probably don’t need it. What’s a hook mistake you’ve made (or still make)? 😄 #React #WebDevelopment #Frontend #JavaScript #Programming #CodingTips
To view or add a comment, sign in
-
-
React concepts every developer should know 🚀⚛️ If you're learning React, these are some of the most important building blocks: 🔹 Components Reusable pieces of UI. Instead of repeating code, you create small independent blocks like Navbar, Card, Button, etc. 🔹 JSX A syntax that lets you write HTML-like code inside JavaScript. It makes UI creation easier and more readable. 🔹 Props Short for “properties.” Used to pass data from a parent component to a child component. 🔹 useState() A React Hook used to store and update dynamic data inside a component, such as counters, form inputs, toggles, etc. 🔹 useEffect() Used for side effects like fetching APIs, updating the DOM, timers, or reacting to state changes. 🔹 Prop Drilling When data is passed through multiple components just to reach a deeply nested child. This can become hard to manage. 🔹 Context A solution to avoid prop drilling. It allows global sharing of data like themes, authentication, language, etc. 🔹 Reducers Used for managing complex state logic in a predictable way, usually with useReducer(). 💡 Master these concepts and React becomes much easier to understand. #ReactJS #WebDevelopment #Frontend #JavaScript #Coding #SoftwareEngineering #ReactDeveloper #100DaysOfCode
To view or add a comment, sign in
-
-
Props vs State in React Most beginners get confused between Props and State in React. At first, both seem similar because both store data. But the real difference is simple: * Props = Data received from another component * State = Data managed inside the component Example: function Parent() { return <Child name="Durgesh" />; } function Child(props) { return <h1>{props.name}</h1>; } Here, `name` is a prop because it comes from the Parent component. Now look at State: const [count, setCount] = useState(0); Here, `count` is managed inside the same component. Quick Difference 👇 • Props are read-only • State can be updated • Props come from parent to child • State belongs to the component itself Think like this: Props = Things you receive State = Things you control Once you understand this difference, React becomes much easier. What confused you more when learning React — Props or State? #react #javascript #frontend #webdevelopment #reactjs #coding
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