diff --git a/src/BoardSwitcher.js b/src/BoardSwitcher.js index 61ad96f..16c54c2 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 = { + click:0 + } + } + + + isClicked= () => { + if(this.state.click < 2){ + this.setState({ + click: this.state.click = this.state.click + 1 + }); + } + else{ + this.setState({ + click: this.state.click = 0 + }); + } + } render() { let boards = []; for (let ii = 0; ii < this.props.numBoards; ii++) { - let isSelected = ii === 0; + let isSelected = ii === this.state.click; boards.push( ); @@ -27,7 +48,7 @@ class BoardSwitcher extends React.Component { return (
{boards}
- +
); }