diff options
author | Renard | 2019-09-25 15:33:33 -0300 |
---|---|---|
committer | Renard | 2019-09-25 15:33:33 -0300 |
commit | 2e496411a387493e87087d90deb4ed5efe3c3417 (patch) | |
tree | 28f4043d37275abc82a78b739e2ef35afdfffd87 /src/App.js | |
parent | 30d3bf92fe11bcdfeeaf070732f28d9cd5be799a (diff) | |
download | bai-client-2e496411a387493e87087d90deb4ed5efe3c3417.tar.gz bai-client-2e496411a387493e87087d90deb4ed5efe3c3417.tar.xz bai-client-2e496411a387493e87087d90deb4ed5efe3c3417.zip |
Variable destructuring ✨
Diffstat (limited to 'src/App.js')
-rw-r--r-- | src/App.js | 42 |
1 files changed, 16 insertions, 26 deletions
@@ -61,18 +61,16 @@ class App extends Component { } render() { - if (!this.state.isLoaded) { - if (!this.state.isLoaded) { - return ( - <Loader active centered="true"> - Cargando ... - </Loader> - ); - } + const { boardList, nightMode, isLoaded } = this.state; + + if (!isLoaded) { + return ( + <Loader active centered="true"> + Cargando ... + </Loader> + ); } - const { boardList } = this.state; - //const pathList = boardList.map(board => "/" + board.dir) return ( <React.Fragment> <Menu inverted fixed="top"> @@ -113,38 +111,30 @@ class App extends Component { </Dropdown> <Menu.Menu position="right"> <Menu.Item as="a" onClick={this.toggleTheme}> - {this.state.nightMode ? ( - <Icon name="sun" /> - ) : ( - <Icon name="moon" /> - )} + {nightMode ? <Icon name="sun" /> : <Icon name="moon" />} </Menu.Item> </Menu.Menu> </Container> </Menu> <Container className="main"> <Router> - <Home - boardList={this.state.boardList} - path="/" - nightMode={this.state.nightMode} - /> + <Home boardList={boardList} path="/" nightMode={nightMode} /> <Thread - boardList={this.state.boardList} + boardList={boardList} path="/:dir/read/:id" - nightMode={this.state.nightMode} + nightMode={nightMode} > <Thread path=":active" /> </Thread> <Board - boardList={this.state.boardList} + boardList={boardList} path="/board/:dir" - nightMode={this.state.nightMode} + nightMode={nightMode} /> <ThreadList - boardList={this.state.boardList} + boardList={boardList} path="/list/:dir" - nightMode={this.state.nightMode} + nightMode={nightMode} /> <NotFound default /> </Router> |