Permalink
Browse files

refactoring for multisnek

  • Loading branch information...
stnbu committed Sep 16, 2018
1 parent 305e172 commit 786ee8931d92ae76eb64b3dd22b9fe626d0228c9
Showing with 8 additions and 6 deletions.
  1. +8 −6 soat.html
@@ -55,16 +55,16 @@
/>
);
const SVG = ({ circles }) => (
<svg>
const Snake = ({ circles }) => (
<g>
{
circles.map((position, i) => <Circle key={i} position={position} index={i}/>)
}
</svg>
</g>
);
class Snake extends React.Component {
class Arena extends React.Component {
constructor(props) {
super(props);
this.changeThing = this.changeThing.bind(this);
@@ -129,13 +129,15 @@
render() {
return (
<div tabIndex="1" ref="playArea" onKeyDown={this.changeThing}>
<SVG circles={this.state.body} />
<svg>
<Snake circles={this.state.body} />
</svg>
</div>
);
}
}
ReactDOM.render(<Snake />, document.getElementById("root"));
ReactDOM.render(<Arena />, document.getElementById("root"));
</script>

0 comments on commit 786ee89

Please sign in to comment.