Skip to content

Instantly share code, notes, and snippets.

@angus-c
Created April 1, 2015 00:44
Show Gist options
  • Save angus-c/3cf21d2729807cdd3666 to your computer and use it in GitHub Desktop.
Save angus-c/3cf21d2729807cdd3666 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/vogefa
<!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>
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