Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="https://fb.me/react-15.1.0.js"></script>
  <script src="https://fb.me/react-dom-15.1.0.js"></script>
</head>
<body>
  <div id="app"></div>
</body>
</html>
 
class Inputs extends React.Component {
  componentWillMount() {
    this.setState({
      // value: '', // <---- this doesn't show the warning!!
      value: undefined, // <---- Set it to empty string
    });
  }
  
  setValue(event) {
    this.setState({
      value: event.target.value,
    });
  }
  
  render() {
    return (
      <div>
        <input
          type="text"
          onChange={(event) => this.setValue(event)}
          value={this.state.value}
        />
      </div>
    );
  }
}
ReactDOM.render(<Inputs />, document.getElementById('app'));
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
crysfelpro
0viewers