diff --git a/src/BoardSwitcher.js b/src/BoardSwitcher.js index 61ad96f..d8adf72 100644 --- a/src/BoardSwitcher.js +++ b/src/BoardSwitcher.js @@ -15,10 +15,31 @@ 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 + }); + } + render() { let boards = []; + for (let ii = 0; ii < this.props.numBoards; ii++) { - let isSelected = ii === 0; + + if (this.state.clicks === 3) { + // eslint-disable-next-line react/no-direct-mutation-state + this.state.clicks = 0; + } + + let isSelected = ii === this.state.clicks; + boards.push( ); @@ -27,7 +48,7 @@ class BoardSwitcher extends React.Component { return (
{boards}
- +
); }