React/create-a-controlled-input Test problem

class ControlledInput extends React.Component {
  constructor(props) { super(props);
   this.state = {
     input: ''
    };    
    this.changeHandler = this.changeHandler.bind(this) 
  }  
  changeHandler(e) {
    const val = e.target.value;
    this.setState({input: val} )
  }  
  render() {
    return (
      <div>      
        <input onChange={this.changeHandler} />       
        <h4>Controlled Input:</h4>
        <p>{this.state.input}</p>
      </div>
    );
  }
};

Error : “react-dom-test-utils.production.min.js:28 act(…) is not supported in production builds of React, and might not behave as expected.”

You have to remember to set the value of the input to this.state.input - that’s the idea of a “controlled component,” it’s value is being set from state.

Look to my code I did not forgot it. Code work ,the error rise during the test.

The error is unrelated to you not passing the challenge. You can ignore it.

As said, you didn’t create a controlled input, the value attribute has to be managed by the component state.

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