Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE HTML>
<body>
<script src="https://fb.me/react-with-addons-0.14.7.min.js"></script>
<script src="https://fb.me/react-dom-0.14.7.min.js"></script>
<div id="app" />
</body>
 
button, li { cursor: pointer }
.selected {
  color: red;
}
 
function getData() {
  return new Promise(resolve => setTimeout(() => {
    resolve('bar');
  }, 2000));
}
class App extends React.Component {
  state = {
    data: 'foo'
  };
  componentDidMount() {
    getData().then(data => {
      this.setState({ data });
    })
  }
  render() {
    return <div> {this.state.data} </div>;
  }
}
ReactDOM.render(
  <App />,
  document.getElementById('app')
);
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers