diff --git a/src/BoardSwitcher.js b/src/BoardSwitcher.js index 61ad96f..8c02a16 100644 --- a/src/BoardSwitcher.js +++ b/src/BoardSwitcher.js @@ -14,11 +14,26 @@ class Board extends React.Component { } } + + class BoardSwitcher extends React.Component { + constructor(props) { + super(props); + this.state = { + clicks: 0 + }; + } + + handleToggle(event) { + this.setState({ + clicks: (this.state.clicks + 1) % this.props.numBoards //???% 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( ); @@ -27,7 +42,7 @@ class BoardSwitcher extends React.Component { return (
{boards}
- +
); }