Understanding ReactJS: Questions and Answers

⚛️ 𝗧𝗼𝗽 𝟭𝟬 𝗥𝗲𝗮𝗰𝘁.𝗷𝘀 𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 𝗤𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀 𝗤𝟭. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗥𝗲𝗮𝗰𝘁.𝗷𝘀? It’s like Lego for websites — you build your UI using small, reusable pieces called components. 𝗤𝟮. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗩𝗶𝗿𝘁𝘂𝗮𝗹 𝗗𝗢𝗠? React keeps a fake copy of the webpage (Virtual DOM) and only changes what’s needed instead of repainting everything — that’s why it’s fast. 𝗤𝟯. 𝗖𝗼𝗻𝘁𝗿𝗼𝗹𝗹𝗲𝗱 𝘃𝘀 𝗨𝗻𝗰𝗼𝗻𝘁𝗿𝗼𝗹𝗹𝗲𝗱 𝗖𝗼𝗺𝗽𝗼𝗻𝗲𝗻𝘁𝘀? Controlled = React is the boss (it controls the input value). Uncontrolled = the input manages itself, React just checks in later. 𝗤𝟰. 𝗪𝗵𝗮𝘁 𝗮𝗿𝗲 𝗛𝗼𝗼𝗸𝘀 𝗶𝗻 𝗥𝗲𝗮𝗰𝘁? Hooks are shortcuts to use state and lifecycle in function components — no more long class code. 𝗤𝟱. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗥𝗲𝗱𝘂𝘅? Think of it as one big box where all your app data stays — everyone (components) takes and updates data from the same place. 𝗤𝟲. 𝗥𝗲𝗱𝘂𝗰𝗲𝗿, 𝗔𝗰𝘁𝗶𝗼𝗻, 𝗦𝘁𝗼𝗿𝗲 — 𝘄𝗵𝗮𝘁’𝘀 𝘁𝗵𝗮𝘁? Action = what you want to do, Reducer = how to do it, Store = where it all happens. 𝗤𝟳. 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗥𝗲𝗱𝘂𝘅 𝗧𝗵𝘂𝗻𝗸? A helper that lets Redux wait for async stuff like API calls before updating data — like saying “hold on, let me finish fetching first.” 𝗤𝟴. 𝗖𝗹𝗮𝘀𝘀 𝘃𝘀 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻 𝗖𝗼𝗺𝗽𝗼𝗻𝗲𝗻𝘁𝘀? Class = old school, more typing, this headaches. Function = clean, faster, uses hooks. 𝗤𝟵. 𝗛𝗼𝘄 𝗱𝗼 𝘄𝗲 𝘂𝘀𝗲 𝗰𝗼𝗺𝗽𝗼𝗻𝗲𝗻𝘁𝗪𝗶𝗹𝗹𝗨𝗻𝗺𝗼𝘂𝗻𝘁 𝗶𝗻 𝗳𝘂𝗻𝗰𝘁𝗶𝗼𝗻𝘀? In useEffect, you return a cleanup function — that’s React’s way of saying “when leaving, do this.” 𝗤𝟭𝟬. 𝗘𝘅𝗽𝗼𝗿𝘁 𝘃𝘀 𝗘𝘅𝗽𝗼𝗿𝘁 𝗗𝗲𝗳𝗮𝘂𝗹𝘁? export = you can send many things, must import with exact name. export default = you send one thing, name doesn’t matter. #ReactJS #WebDevelopment #JavaScript #FrontendDeveloper #CodingInterviews #ReactInterview #TechCareers #WebDev #Frontend #SoftwareEngineering #LearnReact #CodingTips

To view or add a comment, sign in

Explore content categories