FAQ: Child Components Update Their Parents' state - Child Components Update Their Parents' state

This community-built FAQ covers the “Child Components Update Their Parents’ state” exercise from the lesson “Child Components Update Their Parents’ state”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn ReactJS: Part II

FAQs on the exercise Child Components Update Their Parents’ state

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I think this lesson is broken. I put this.handleChange and it still gave me an error. Can anyone tell me why? This was the first question. At first I thought it was this.changeName which would have made more sense considering they told me to look there. I have no idea where handleChange came from.

import React from 'react';

export class Child extends React.Component {
  render() {
    return (
          Hey my name is {this.props.name}!
        <select id="great-names" onChange={this.handleChange}>
          <option value="Frarthur">

          <option value="Gromulus">

          <option value="Thinkpiece">

Hi, Could anyone please explain why we need to define the variable total instead of incrementing the totalClick inside the object? In other words, are the codes below equivalent?

// code from the excercise
handleClick() {
    const total = this.state.totalClicks;

    // calling handleClick will 
      { totalClicks: total + 1 }
// code that might also work
handleClick() {
      { totalClicks: this.state.totalClick + 1 }