Understanding JSX: How it becomes Real UI with React

𝗗𝗮𝘆 𝟬𝟮 𝗼𝗳 𝟙𝟝 – 𝗗𝗲𝗲𝗽 𝗗𝗶𝘃𝗶𝗻𝗴 𝗶𝗻𝘁𝗼 𝗥𝗲𝗮𝗰𝘁 Many developers use JSX every day, but very few stop to think about what JSX actually is and how it creates the UI we see on the screen. JSX is not HTML. It is simply a syntax that allows us to describe UI using JavaScript in a readable way. However, neither JavaScript nor the browser understands JSX directly. So what really happens behind the scenes? We use a tool called a 𝗧𝗿𝗮𝗻𝘀𝗽𝗶𝗹𝗲𝗿 (such as Babel or ESBuild). Its job is to convert JSX into plain JavaScript objects known as 𝗥𝗲𝗮𝗰𝘁 𝗘𝗹𝗲𝗺𝗲𝗻𝘁𝘀. Once JSX is transformed into React Elements, React passes them to the 𝗥𝗲𝗮𝗰𝘁 𝗥𝗲𝗻𝗱𝗲𝗿𝗲𝗿 (𝗥𝗲𝗮𝗰𝘁 𝗗𝗢𝗠). React DOM then creates a 𝗩𝗶𝗿𝘁𝘂𝗮𝗹 𝗗𝗢𝗠, compares changes efficiently, and updates only the required parts of the actual UI. The overall flow looks like this: 𝗝𝗦𝗫 → 𝗧𝗿𝗮𝗻𝘀𝗽𝗶𝗹𝗲𝗿 (𝗕𝗮𝗯𝗲𝗹 / 𝗘𝗦𝗕𝘂𝗶𝗹𝗱) → 𝗥𝗲𝗮𝗰𝘁 𝗘𝗹𝗲𝗺𝗲𝗻𝘁𝘀 → 𝗥𝗲𝗮𝗰𝘁 𝗥𝗲𝗻𝗱𝗲𝗿𝗲𝗿 → 𝗩𝗶𝗿𝘁𝘂𝗮𝗹 𝗗𝗢𝗠 → 𝗨𝗽𝗱𝗮𝘁𝗲𝗱 𝗨𝗜 Today’s post explains how JSX becomes real UI. This series focuses on understanding React from the inside out. More coming in 𝗗𝗮𝘆 𝟬𝟯. #ReactJS #JavaScript #WebDevelopment #FrontendDevelopment #LearningInPublic #15DaysOfReact #JSX #ReactRenderer

  • diagram

To view or add a comment, sign in

Explore content categories