Questions about the solution


Please help me understand as I am new to React and can’t grasp the pattern just yet.

I have 2 questions:

  1. On parent.js file, changeName function is defined like this:
changeName(newName) {
      name: newName

My question is, what does the parameter “newName” means and where does it come from?

  1. Also on Parent.js file’s render:
  render() {
    return <Child name={} onChange={this.changeName}/>

Why does the attribute “onChange” equal to {this.changeName} even if in the Child.js file, it does not call the changeName, instead it calls the handleChange(e) method in the tag.

I cannot visualize the pattern just yet, please help me understand. Thank you.

Here is the link :


Somebody help please

  1. New name is the import to the function of changeName.
    changeName is a function whose job is to change the state of ‘name’ to a new value which is newName.
  2. The reason onChange equals to {this.changeName} is because we want to pass the function onChange as a prop to the ‘Child’ component


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.