JSX, function components, props, state, events, conditional rendering, lists and keys, and lifting state up.
40 cards · basic cards · AI-written, checked twice. Edit anything.
- What is JSX?
Show answer
A syntax extension to JavaScript that lets you write HTML-like code to describe UI elements
- JSX code transpiles to what function calls?
Show answer
React.createElement() calls
- How do you embed JavaScript expressions in JSX?
Show answer
Wrap them in curly braces: {expression}
- In JSX, what HTML attribute name becomes className?
Show answer
class
- Do inline CSS objects in JSX use dashes or camelCase?
Show answer
camelCase: backgroundColor, not background-color
- What is a React function component?
Show answer
A JavaScript function that returns JSX
- What must every function component return?
Show answer
A JSX element or null
- How should React component names be formatted?
Show answer
PascalCase: MyComponent, not myComponent
- Do function components use lifecycle methods like componentDidMount?
Show answer
No, use the useEffect hook instead
- What are props?
Show answer
Arguments passed to a component that contain data the component should display
- Are props mutable within a component?
Show answer
No, props are read-only and cannot be modified
- How do you access props in a function component?
Show answer
They are passed as the first parameter: function MyComponent(props) {}
- What value does a prop have if it is not provided to a component?
Show answer
undefined
- How do you pass props to a component?
Show answer
Add attributes in the JSX: <MyComponent name="John" age={30} />
- What is prop drilling?
Show answer
Passing props through intermediate components that do not use them to reach nested components