In the Learn React lesson “Create a Controlled Input”, the tests for my code passes, but there appears to be a bug in how the preview is behaving. The input box is visible initially, but the entire markup disappears once you start typing. I’m doing the lesson in Firefox on MacOS. I’ve pasted my code below.
class ControlledInput extends React.Component {
constructor(props) {
super(props);
this.state = {
input: ''
};
this.handleChange = this.handleChange.bind(this);
}
handleChange(event) {
this.setState(state => ({
input: event.target.value
}));
}
render() {
return (
<div>
<input value={this.state.input} onChange={this.handleChange} />
<h4>Controlled Input:</h4>
<p>{this.state.input}</p>
</div>
);
}
};