ReactJS 2026: JSX & Props vs State

𝗥𝗲𝗮𝗰𝘁.𝗷𝘀 𝗣𝗮𝗿𝘁 𝟮 (𝟮𝟬𝟮𝟲): 𝗝𝗦𝗫 𝗮𝗻𝗱 𝗣𝗿𝗼𝗽𝘀 𝘃𝘀 𝗦𝘁𝗮𝘁𝗲 𝗗𝗲𝗲𝗽 𝗗𝗶𝘃𝗲 🔥 𝗛𝗶 𝗲𝘃𝗲𝗿𝘆𝗼𝗻𝗲! 👋 In my last post, we discussed why React continues to dominate the frontend ecosystem in 2026. Today, let’s dive into two foundational concepts that every React developer must understand deeply: ✅ JSX (what it is + why it exists) ✅ Props vs State (data flow + behavior + re-render rules) 1) 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗝𝗦𝗫? 🤔 JSX stands for: 𝗝𝗦𝗫 = 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 + 𝗫𝗠𝗟 It allows us to write UI directly inside JavaScript, in a way that looks like HTML. It’s syntax that gets compiled into JavaScript behind the scenes. ✅ Why JSX exists (in simple terms) JSX makes React code:  • More readable  • Easier to maintain  • Faster to build UIs  • Better supported by IDEs + TypeScript 👉 𝗞𝗲𝘆 𝗿𝘂𝗹𝗲 𝘁𝗼 𝗿𝗲𝗺𝗲𝗺𝗯𝗲𝗿: 𝗔𝗻𝘆𝘁𝗵𝗶𝗻𝗴 𝗶𝗻𝘀𝗶𝗱𝗲 { } 𝗶𝘀 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁. 𝗝𝗦𝗫 𝗿𝘂𝗹𝗲𝘀 𝗲𝘃𝗲𝗿𝘆 𝗯𝗲𝗴𝗶𝗻𝗻𝗲𝗿 𝗺𝘂𝘀𝘁 𝗸𝗻𝗼𝘄  • Return one parent element  • Use className instead of class  • Close all tags properly  • Event handlers use camelCase (onClick, onChange) 2) 𝗣𝗿𝗼𝗽𝘀 𝘃𝘀 𝗦𝘁𝗮𝘁𝗲 ⚡ This is where most React confusion begins, and once you understand it, React becomes easy. ✅ Props (Parent → Child) 𝗣𝗿𝗼𝗽𝘀 𝗮𝗿𝗲 𝘃𝗮𝗹𝘂𝗲𝘀 𝗽𝗮𝘀𝘀𝗲𝗱 𝗳𝗿𝗼𝗺 𝗮 𝗽𝗮𝗿𝗲𝗻𝘁 𝗰𝗼𝗺𝗽𝗼𝗻𝗲𝗻𝘁 𝘁𝗼 𝗮 𝗰𝗵𝗶𝗹𝗱 𝗰𝗼𝗺𝗽𝗼𝗻𝗲𝗻𝘁. Props are:  • Read-only (child can’t modify them)  • Unidirectional (flow only downward)  • Like function arguments 𝗪𝗵𝗮𝘁 𝗵𝗮𝗽𝗽𝗲𝗻𝘀 𝘄𝗵𝗲𝗻 𝘁𝗵𝗲 𝗽𝗮𝗿𝗲𝗻𝘁 𝗿𝗲-𝗿𝗲𝗻𝗱𝗲𝗿𝘀? When the parent state changes:  1. Parent re-renders  2. New props are passed  3. Child re-renders with fresh props  4. That’s React’s default behavior. ✅ State (Component’s internal memory) 𝗦𝘁𝗮𝘁𝗲 𝗶𝘀 𝗶𝗻𝘁𝗲𝗿𝗻𝗮𝗹 𝗱𝗮𝘁𝗮 𝘀𝘁𝗼𝗿𝗲𝗱 𝗶𝗻𝘀𝗶𝗱𝗲 𝗮 𝗰𝗼𝗺𝗽𝗼𝗻𝗲𝗻𝘁. State is:  • Mutable (changes over time)  • Local to the component  • Triggers re-render when updated 🔥 Important: State survives re-renders. If React re-renders a component, the state does NOT reset. 𝗕𝘂𝘁... ❌ State does NOT survive page refresh Refreshing the page restarts the entire React app: ❌ All state is lost ✅ Components start fresh ✅ Props are re-initialized If you want the state to persist across refresh, you need:  • localStorage  • sessionStorage  • database  • cookies  • URL params 🎯 The easiest way to remember  • 𝗣𝗿𝗼𝗽𝘀 = 𝗲𝘅𝘁𝗲𝗿𝗻𝗮𝗹 𝗱𝗮𝘁𝗮 (𝗽𝗮𝘀𝘀𝗲𝗱 𝗶𝗻)  • 𝗦𝘁𝗮𝘁𝗲 = 𝗶𝗻𝘁𝗲𝗿𝗻𝗮𝗹 𝗱𝗮𝘁𝗮 (𝗺𝗮𝗻𝗮𝗴𝗲𝗱 𝗶𝗻𝘀𝗶𝗱𝗲) Next post: 𝚁̲𝚎̲𝚊̲𝚌̲𝚝̲ ̲𝙷̲𝚘̲𝚘̲𝚔̲𝚜̲ ̲𝙳̲𝚎̲𝚎̲𝚙̲ ̲𝙳̲𝚒̲𝚟̲𝚎̲ ̲(̲𝚞̲𝚜̲𝚎̲𝚂̲𝚝̲𝚊̲𝚝̲𝚎̲,̲ ̲𝚞̲𝚜̲𝚎̲𝙴̲𝚏̲𝚏̲𝚎̲𝚌̲𝚝̲,̲ ̲𝚞̲𝚜̲𝚎̲𝚁̲𝚎̲𝚏̲)̲ ̲+̲ ̲𝚆̲𝚑̲𝚎̲𝚗̲ ̲𝚝̲𝚘̲ ̲𝚞̲𝚜̲𝚎̲ ̲𝚎̲𝚊̲𝚌̲𝚑̲🚀̲ ̲ If you found this helpful, drop a 👍 or comment “Part 3,” and I’ll share the next one. #ReactJS #JavaScript #FrontendDevelopment #WebDevelopment #React2026 #LearnReact #StateManagement

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories