Recall & Review
beginner
What is state in React?
State is a way to store data inside a component that can change over time. It controls the component's behavior and appearance. When state changes, the component updates its output.
Click to reveal answer
beginner
What are props in React?
Props are inputs passed from a parent component to a child component. They are read-only and cannot be changed by the child component.
Click to reveal answer
beginner
Can a component change its own props?
No, a component cannot change its own props. Props are controlled by the parent component and are read-only inside the child.
Click to reveal answer
intermediate
When should you use state instead of props?
Use state when you need to keep track of data that changes inside the component, like user input or toggles. Use props to pass fixed or external data from parent to child.
Click to reveal answer
beginner
How does changing state affect a React component?
Changing state causes the component to re-render, updating what the user sees. This makes the UI dynamic and interactive.
Click to reveal answer
Which of the following can a React component modify directly?
✗ Incorrect
A component can modify its own state but cannot change its props, which come from the parent.
Props in React are:
✗ Incorrect
Props are immutable inputs passed from parent to child components.
What happens when a component's state changes?
✗ Incorrect
State changes trigger a re-render to update the UI.
Which is true about props?
✗ Incorrect
Props pass data from parent to child and are read-only in the child.
When should you use state in a React component?
✗ Incorrect
State is for data that changes inside the component and affects rendering.
Explain the difference between state and props in React.
Think about who controls the data and if it can change inside the component.
You got /4 concepts.
Describe a real-life example where you would use state and another where you would use props in a React app.
Imagine a form input for state and a label showing a name for props.
You got /4 concepts.