From 16709b63cfbd91a3396c28bca9d6b32c1a7369d9 Mon Sep 17 00:00:00 2001 From: caesarc6 <46427941+caesarc6@users.noreply.github.com> Date: Thu, 23 Sep 2021 14:48:02 -0400 Subject: [PATCH] Update SwitchBoard.js --- src/BoardSwitcher.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) 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}
- +
); }