Skip to content
Advertisement

Can a child method have change handler in React?

I was wondering why the child component with the changed value is not getting rendered here.

Isn’t it a good idea to have a child handle its own changes or better to have the controller in the parent?

JavaScript

This is the Child TodoItem

JavaScript

As you can see the state is changed with handleChange() but this does not fire the render. I am also not too sure if another object can be assigned to an object of the state (let tempObj = thi.state.isComp).

The functionality I am trying to achieve is check and uncheck a box and render accordingly.

Advertisement

Answer

What is this?

JavaScript

I think it should be

JavaScript
Advertisement