React
Fondamental
Lifting state up between sibling components
Type d'évaluation
Mise en situation réelle
Analyse
Intelligence Artificielle
Compétences ciblées
react
state-lifting
sibling-components
props
usestate
Scénario Technique
Context Two sibling components — a temperature input and a unit selector — need to stay in sync with each other. The Problem Each component manages its own local state independently, so changing the unit in one component does not update the displayed value in the other. Constraints Move the shared state to the closest common parent. Pass state and setter functions down as props. Do not use any global state library. Expected Deliverable A React implementation of the state lifting pattern, where a parent component coordinates state between two sibling components through props.
Prêt à évaluer ce talent ?
Accédez à l'interface de test complète pour soumettre votre architecture ou votre code.