diff --git a/src/BoardSwitcher.js b/src/BoardSwitcher.js index 61ad96f..7edb996 100644 --- a/src/BoardSwitcher.js +++ b/src/BoardSwitcher.js @@ -15,10 +15,24 @@ class Board extends React.Component { } class BoardSwitcher extends React.Component { + constructor(props){ + super(props); + this.state = { + clicks: 0, + }; + } +handleClick(event) +{ + +this.setState({ + clicks: (this.state.clicks + 1) % this.props.numBoards, +}); +} render() { + let boards = []; for (let ii = 0; ii < this.props.numBoards; ii++) { - let isSelected = ii === 0; + let isSelected = ii === this.state.clicks ; boards.push( ); @@ -26,9 +40,10 @@ class BoardSwitcher extends React.Component { return (
-
{boards}
- +
{boards}
+
+ ); } }