Can you tell me what is wrong with this?

Tell us what’s happening:

Your code so far

class ControlledInput extends React.Component {
  constructor(props) {
    this.state = {
      input: ''
    // change code below this line
    // change code above this line
  // change code below this line
  const [name,value]
  // change code above this line
  render() {
    return (
        { /* change code below this line */}
        { /* change code above this line */}
        <h4>Controlled Input:</h4>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0.

Link to the challenge:

const [name, value] =

This says that the value of is an array with two items, and you’re assigning them to the variables name and value respectively. This isn’t correct: you are extracting the fields of an object, so it should be {name, value}

Also, this seems unecessarily complex: why not just set the state’s input property to You don’t need to compute the name of the property, you already know it.

Destructuring went wrong under handleChange

thanks brother, I got it.

1 Like