Pregunta de entrevista de Solution Design Group

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

Respuesta de la entrevista

Anónimo

10 jul 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.