Question d’entretien chez Solution Design Group

In ReactJS, how would you handle data that changes in a child component that affects its parent component?

Réponse à la question d'entretien

Utilisateur anonyme

10 juil. 2023

I would lift the state out of the child component, add it as a new state variable to the parent component, implement a simple state handler function for the new state, and then pass the state as a prop as to ensure re-rendering is consistent between parent and child.