employer cover photo
employer logo
employer logo

Solution Design Group

Is this your company?

Solution Design Group interview question

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

Interview Answer

Anonymous

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.