Rendering and Reconciliation — What Happens on a State Change — Concept Check
Questions on Rendering and Reconciliation — What Happens on a State Change. A render is React calling your function, not React touching the DOM. Separating those two ideas explains re-render behaviour, keys, and most performance advice.
Questions in this quiz
7 questions on Rendering and Reconciliation — What Happens on a State Change — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A component's state is updated using setState, but the UI doesn't change. What could be the reason?
- AThe component did not re-render.
- BThe DOM was rebuilt but not committed.
- CThe state was set to the same value as before.
- DThe component's parent did not re-render.
2.A parent component re-renders, but its child component's props did not change. What happens to the child component?
- AThe child component does not re-render.
- BThe child component's DOM is rebuilt.
- CThe child component re-renders by default.
- DThe child component's state is reset.
3.A developer changes an object's property directly without using setState. What is the consequence?
- AReact triggers a commit phase.
- BReact queues a re-render for the component.
- CReact does not detect the change.
- DReact updates the DOM immediately.
4.What happens during the render phase in React?
- AThe DOM is updated with new changes.
- BThe component's state is reset.
- CReact calls component functions to produce a UI description.
- DEffects run after the browser paints.
5.If two components of the same type are switched in a position without keys, what happens?
- ABoth components are treated as different instances.
- BThe DOM nodes are destroyed and rebuilt.
- CThe components' props are swapped.
- DThe component state is preserved across the toggle.
6.A list of items is rendered without keys. What issue might arise?
- AThe list items will not update on changes.
- BReact cannot differentiate items, leading to incorrect updates.
- CReact will not render the list.
- DThe list will render twice.
7.What triggers a component re-render in React?
- ADirectly mutating an object property.
- BChanging a variable outside the component.
- CIts parent component re-renders.
- DSetting state to the same value.