1. What is JSX?
JSX (JavaScript XML) is a syntax extension for JavaScript. It lets you write HTML-like code directly in your JavaScript files, making your component's structure easy to read.
const element = <h1>Hello, world!</h1>;
2. What are React Hooks (useState, useEffect)?
Hooks are functions that let you "hook into" React features from functional components.
useState: Lets you add state (data that changes) to a component.
useEffect: Lets you perform "side effects," like fetching data from an API or setting a timer, after the component renders.
3. What is React Conditional Rendering?
This is how you show or hide content. In React, you just use regular JavaScript logic (like if statements, the && operator, or ternary operators) inside your JSX.
{isLoggedIn ? <WelcomeUser /> : <GuestLogin />}
4. State Management: React Context API vs Redux
- React Context API: Built into React, perfect for passing data deep down without "prop drilling." Best for data that doesn't change often (like user theme).
- Redux: A powerful, external library for managing complex global state that changes frequently (like a shopping cart).