Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
  <script src="//fb.me/react-with-addons-0.13.1.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var Survey = React.createClass({
    render: function() {
        return (<div>{this.props.description}</div>);
    }
});
// tutorial2.js
var SurveyList = React.createClass({
  getInitialState: function() {
      return {
          data:[]
        };
  },
  componentDidMount: function() {
      this.serverRequest = $.ajax({
        url: this.props.url, 
        dataType: 'jsonp',
        success: function(result) {
          console.log(result)
          this.setState({
            data: result
          });
        }.bind(this)
      });
  },
  render: function() {
    var surveyNodes = this.state.data.map(function(survey){
      console.log(survey);
      return (<Survey description={survey.description}></Survey>);
    });
    return (
        <div>{surveyNodes}</div>
    );
  }
});
 
React.render(<SurveyList url="http://www.mocky.io/v2/56fcf6871000000e13aed252"/>, document.body);
Output

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

Dismiss x
public
Bin info
jackvialpro
0viewers