React
Fondamental
Passing functions as props to child components

Type d'évaluation

Mise en situation réelle

Analyse

Intelligence Artificielle

Compétences ciblées

react
props
callbacks
state-lifting
components

Scénario Technique

Context A parent component manages a shopping cart, and a child component displays individual items with a remove button. The Problem The child component has no way to notify the parent when an item should be removed, so the remove button currently has no effect. Constraints Define the removeItem handler in the parent component. Pass it as a prop to the child component. Call the function from the child's button onClick. Expected Deliverable A React parent-child component pair demonstrating upward communication via callback props, correctly updating parent state from a child action.

Prêt à évaluer ce talent ?

Accédez à l'interface de test complète pour soumettre votre architecture ou votre code.

Commencer le Défis
    React - Passing functions as props to child components | Défi Technique & Recrutement — CodeDuel