⚠️ React Is Powerful… But This Confused Me. I just started learning React. And honestly… I like it. Components? Reusable code? Clean structure? It feels powerful. But then I hit something that made me pause. useState. And how React updates the UI. Coming from JavaScript, I’m used to: • Selecting elements with the DOM • Updating them directly • Seeing changes instantly Simple. Straightforward. But in React? You don’t touch the DOM directly. You update state… and React handles the rest. That felt confusing at first. Like… “Why not just change the DOM myself?” 🤔 But then I started to understand: React is not making things harder. It’s making things predictable and scalable. Instead of manually updating the UI everywhere, you just update the state. And the UI follows. No scattered logic. No messy updates. Just one source of truth. It’s a different way of thinking. Not harder… Just different. And that’s where growth happens. 💬 If you’ve learned React — what confused you the most at the beginning? ReactJS #FrontendDevelopment #JavaScriptDeveloper #WebDevelopmentJourney #LearnToCode
React Confusion: Understanding useState and DOM Updates
More Relevant Posts
-
I used to think React.ReactNode and React.ReactElement were the same thing… They are NOT. And this mistake silently breaks a lot of beginner code Here’s the simplest way I now understand it: *React.ReactNode = anything React can render *React.ReactElement = only JSX elements Sounds small, but watch this If you write: children: React.ReactElement You just blocked this: <Container>Hello</Container> Because "Hello" is NOT a ReactElement. But when you use: children: React.ReactNode Now everything works: ✅ Text ✅ Components ✅ Elements ✅ Even null When to use : ✅ Use React.ReactNode when: * You’re typing children * You want flexibility * You don’t care what gets rendered, as long as React can display it Avoid React.ReactNode when: * You need strict control over what is passed ✅ Use React.ReactElement when: * You want ONLY JSX/components * You’re enforcing structure (e.g. design systems, wrappers) *Avoid React.ReactElement when: * You expect text, numbers, or mixed content What I learned today: TypeScript isn’t just about types… It’s about preventing subtle bugs before they happen I’m currently learning React + TypeScript and sharing what I discover daily. If you’re on the same journey, let’s connect 🤝 #typescript #reactjs #frontenddeveloper #webdevelopment #codingjourney #javascript #buildinpublic #devcommunity #learninpublic
To view or add a comment, sign in
-
-
I wasted months trying to learn React. Not because React is hard… But because my JavaScript was weak. ↓ Everyone wants to jump into React: Hooks. APIs. Projects. It looks exciting. But here’s what most beginners don’t realize: React is just JavaScript under the hood. If your JS isn’t strong, React will feel confusing. ↓ What I was missing: → Functions and arrow functions → Arrays and objects → Destructuring → ES6 concepts → Async JavaScript (Promises, async/await) I was copying code……but not understanding it. ↓ Everything changed when I stopped chasing frameworks… …and fixed my fundamentals. Suddenly: → Components started making sense → State was no longer “magic” → Debugging became easier ↓ If you’re learning frontend right now: Don’t make this mistake. Skip the hype. Build your foundation first. ↓ Smart way to learn: → Focus on core JavaScript → Solve small logic problems → Then move to React This is how you go from: “copying code” to “building real applications” ↓ Most developers won’t do this. That’s why most stay stuck. ↓ I’ll be sharing a complete React roadmap step by step. ⇒ Visit My Portfolio: 👉 https://lnkd.in/defxD37a Next → Components, Props, and how React actually works ↓ Where are you stuck right now in React or JavaScript? Drop it below. I’ll help 👇 #ReactJS #JavaScript #WebDevelopment #FrontendDeveloper #LearnToCode #CodingJourney #DeveloperCommunity #TechGrowth
To view or add a comment, sign in
-
-
🚀 Just built and pushed my 2nd React + TypeScript projects to GitHub! I know Todo apps get a lot of hate — "It's just a todo app, bro." 😅 But here's what building this actually taught me 👇 𝗪𝗵𝗮𝘁 𝗜 𝗯𝘂𝗶𝗹𝘁: ✅ Add tasks with the Enter key or button click 🗑️ Delete individual tasks 💣 Clear all tasks at once ⚠️ Input validation — no empty tasks allowed 🎨 Clean dark UI with Tailwind CSS 𝗧𝗲𝗰𝗵 𝗦𝘁𝗮𝗰𝗸: ⚛️ React 18 🔷 TypeScript 🎨 Tailwind CSS ⚡ Vite 𝗪𝗵𝗮𝘁 𝗜 𝗮𝗰𝘁𝘂𝗮𝗹𝗹𝘆 𝗹𝗲𝗮𝗿𝗻𝗲𝗱: → useState with TypeScript generics const [todo, setTodo] = useState<Todo[]>([]) → Interface definitions for type safety interface Todo { id, text, completed } → Array methods for state updates filter() for delete, spread for add → Controlled inputs in React value + onChange pattern → Conditional rendering showing an empty state when no tasks The biggest realization? Every "simple" project teaches you something real. TypeScript caught my bugs BEFORE they happened. That's the whole point. 🎯 This is Day 2 of building in public. More projects incoming. 👀 GitHub: https://lnkd.in/gEkQNkmK Live Link: https://lnkd.in/g7i2ZxjA Are you also learning React? Drop a 👋 below — let's connect! #React #TypeScript #WebDevelopment #Frontend #100DaysOfCode #JavaScript #TailwindCSS #BuildInPublic #Developer #Coding
To view or add a comment, sign in
-
-
🚀 Understanding Hooks in React (Simple Explanation) When I first started learning React, I thought state management was only possible with class components… but then I discovered Hooks — and everything changed. 👉 Hooks are special functions in React that allow functional components to use features like state and lifecycle methods. 💡 Example: With useState, we can easily manage state inside a function component — no need for classes anymore. Why Hooks are powerful: ✔ Cleaner and more readable code ✔ Reusable logic across components ✔ Less boilerplate compared to class components ✔ Makes development faster and more scalable Some commonly used Hooks: 🔹 useState – manage state 🔹 useEffect – handle side effects (API calls, timers) 🔹 useRef – access DOM elements 🔥 One simple line: Hooks = extra powers for functional components. Learning Hooks really changed how I write React code — and made development feel much more intuitive. #ReactJS #WebDevelopment #Frontend #JavaScript #LearningInPublic #Developers
To view or add a comment, sign in
-
-
⚠️ React Hooks Look Simple… Until You Try Them. As I’ve been learning useState, I started noticing something…” At first, it looked easy. Just a variable… and a function to update it. Simple, right? That’s what I thought. Until I actually tried using it. Coming from JavaScript, I’m used to changing values directly. But in React? You don’t just change values. You update state… and React re-renders everything for you. That shift? Confusing at first. I found myself asking: “Why can’t I just update it directly?” 🤔 But as I kept practicing, something started to click. React isn’t just about writing code. It’s about thinking differently. Instead of controlling everything manually, you describe what should happen… And React handles the rest. That’s powerful. Still learning. Still making mistakes. But now it’s starting to make sense. 💬 If you’ve learned React hooks — what confused you the most at the beginning? #ReactJS #FrontendDevelopment #JavaScriptDeveloper #WebDevelopmentJourney #LearnToCode
To view or add a comment, sign in
-
I just learned something small in TypeScript today… but it completely changed how I think about handling user state in React Instead of guessing if a user exists or not, I used a proper type: • AuthUser | null That one line made everything safer and cleaner. • No more “undefined errors” flying around. • No more messy checks. • Just clear, predictable state. I built a simple login/logout flow where: • The user is either an object (logged in) • Or null (logged out) And with optional chaining (user?.name), my UI stays smooth without breaking. It may look basic… but this is how solid frontend systems are built one correct type at a time. TypeScript is slowly turning my “it works” code into “it’s reliable” code If you’re learning React + TypeScript, don’t skip this pattern. It’s a game changer. I’m currently deep in my TypeScript journey, sharing what I learn as I grow. Let’s connect 🤝 #typescript #reactjs #frontenddeveloper #webdevelopment #codingjourney #javascript #techinpublic #buildinpublic #devcommunity
To view or add a comment, sign in
-
-
🚀 Mastering React Hooks! 🚀 Ever wondered how to manage state in functional components? React Hooks is the answer! They allow you to add state and other React features to functional components without writing a class. Super convenient, right? 🤩 For developers, mastering React Hooks opens up a whole new world of possibilities in simplifying component logic and making code more readable. So let's dive in step by step: 1️⃣ First, import { useState } from 'react' 2️⃣ Then, declare a state variable using useState hook 3️⃣ Use the state variable and a function to update it Here's an example: ```jsx import React, { useState } from 'react'; function Counter() { const [count, setCount] = useState(0); return ( <div> <p>You clicked {count} times</p> <button onClick={() => setCount(count + 1)}>Click me</button> </div> ); } ``` Pro Tip: Remember to always keep the dependencies array updated to avoid unwanted re-renders! 🌟 Common Mistake Alert: Forgetting to pass all dependencies to the dependencies array can lead to unexpected bugs, so be thorough in checking! ❗️ Ready to level up your React game with Hooks? What cool projects are you planning to build using React Hooks? 💡🛠️ #ReactHooks #JavaScript #WebDev #FrontendDevelopment #StateManagement #LearnToCode #CodeNewbie #TechTips #tharindunipun.lk
To view or add a comment, sign in
-
-
If I had to learn React from scratch in 2026, here's exactly what I'd do. Week 1-2: JavaScript FIRST Don't touch React yet. Master: Array methods, destructuring, spread operator, arrow functions, async/await Why: 80% of React confusion = JavaScript confusion Week 3-4: React basics only Build 3 simple projects: - Counter app - Form with validation - Fetch API data Learn: Components, Props, useState, useEffect Stop here. Master these first. Week 5-6: One real project Build a dashboard with real API integration, loading states, and routing. This becomes your portfolio anchor. Week 7-8: Level up Add one at a time: - React Router - Custom hooks - Context API Month 3+: Build, build, build Stop tutorials. Clone real apps. Share your progress. **What to skip initially:** ❌ TypeScript ❌ Next.js ❌ Redux ❌ Testing Learn React first. Add these when you understand WHY you need them. The biggest mistake: Trying to learn React, TypeScript, Next.js, and Redux all at once. You end up overwhelmed. The solution: Master React. Then add layers. One thing at a time = faster progress. If you're learning React, what's your biggest struggle? 👇 #React #WebDevelopment #JavaScript #Frontend #LearningToCode
To view or add a comment, sign in
-
🚀 React Developer Roadmap – Step by Step Guide If you want to become a React Developer, follow this simple roadmap: 1. HTML + CSS Build strong basics of structure and styling. 2. JavaScript Basics Understand variables, functions, loops, and logic. 3. ES6 Learn modern JavaScript (arrow functions, destructuring, modules). 4. DOM Manipulation Know how JavaScript interacts with the browser. 5. Git & GitHub Version control is a must for every developer. 6. React Basics Components, JSX, props, and state. 7. Hooks Learn useState, useEffect, useRef, etc. 8. React Router Handle navigation between pages. 9. State Management Use Context API or Redux for managing data. 10. Build Projects Practice by creating real-world applications. 💡 Consistency is the key. Learn → Practice → Build → Repeat. 🔥 Start today and become a React Developer! 💬 What stage are you currently at? Comment below! #ReactJS #WebDevelopment #FrontendDeveloper #JavaScript #Coding #Programming #DeveloperRoadmap #LearnToCode #ReactDeveloper
To view or add a comment, sign in
-
-
Mastering React JS starts with strong fundamentals 🚀 Before jumping into advanced concepts, every developer should clearly understand these core basics: 🔹 Components (Functional & Class) The building blocks of any React application. Everything in React is a component. 🔹 JSX (JavaScript XML) Allows you to write HTML-like code inside JavaScript, making UI development more intuitive. 🔹 Props (Passing Data) Used to pass data from one component to another — enabling reusability and clean architecture. 🔹 State (Managing Data) Handles dynamic data inside components and controls how the UI updates. 💡 Key Insight: A strong understanding of these fundamentals makes learning advanced topics like Hooks, State Management, and Performance Optimization much easier. 📌 Don’t rush into advanced React — build a solid foundation first. What concept helped you understand React better? 👇 #ReactJS #FrontendDevelopment #WebDevelopment #JavaScript #SoftwareEngineering
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
Well for me, jumped to react then and didnt master foundations in JS, so i got confused very quickly. One included the different hooks we had or should i talk about props, i'm like, what is this