Created
April 1, 2015 00:44
-
-
Save angus-c/3cf21d2729807cdd3666 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/vogefa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://fb.me/react-with-addons-0.12.2.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var Board = React.createClass({displayName: 'Board', | |
render: function() { | |
var renderCells = function(rows, cols) { | |
return ( | |
React.createElement("table", null, | |
rows.map(function(r) { | |
return ( | |
React.createElement("tr", null, | |
React.createElement("br", null), | |
cols.map(function(c) {return React.createElement("td", null, c)}) | |
) | |
) | |
}) | |
) | |
) | |
} | |
return ( | |
React.createElement("div", null, | |
renderCells(this.props.rows, this.props.cols) | |
) | |
) | |
} | |
}); | |
var rows = [1,2,3,4,5,6,7,8]; | |
var cols = [1,2,3,4,5,6,7,8]; | |
React.render( | |
React.createElement(Board, {rows: rows, cols: cols}), | |
document.body | |
); | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//fb.me/react-with-addons-0.12.2.js"><\/script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
</body> | |
</html></script> | |
<script id="jsbin-source-javascript" type="text/javascript">var Board = React.createClass({ | |
render: function() { | |
var renderCells = function(rows, cols) { | |
return ( | |
<table> | |
{rows.map(function(r) { | |
return ( | |
<tr> | |
<br/> | |
{cols.map(function(c) {return <td>{c}</td>})} | |
</tr> | |
) | |
})} | |
</table> | |
) | |
} | |
return ( | |
<div> | |
{renderCells(this.props.rows, this.props.cols)} | |
</div> | |
) | |
} | |
}); | |
var rows = [1,2,3,4,5,6,7,8]; | |
var cols = [1,2,3,4,5,6,7,8]; | |
React.render( | |
<Board rows={rows} cols={cols} />, | |
document.body | |
);</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Board = React.createClass({displayName: 'Board', | |
render: function() { | |
var renderCells = function(rows, cols) { | |
return ( | |
React.createElement("table", null, | |
rows.map(function(r) { | |
return ( | |
React.createElement("tr", null, | |
React.createElement("br", null), | |
cols.map(function(c) {return React.createElement("td", null, c)}) | |
) | |
) | |
}) | |
) | |
) | |
} | |
return ( | |
React.createElement("div", null, | |
renderCells(this.props.rows, this.props.cols) | |
) | |
) | |
} | |
}); | |
var rows = [1,2,3,4,5,6,7,8]; | |
var cols = [1,2,3,4,5,6,7,8]; | |
React.render( | |
React.createElement(Board, {rows: rows, cols: cols}), | |
document.body | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment