Skip to content

Commit 0662675

Browse files
committed
Use v16 syntax
1 parent 87fe98e commit 0662675

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/pages/App/App.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,15 @@ import SettingsPage from '../SettingsPage/SettingsPage';
77
const colors = ['#7CCCE5', '#FDE47F', '#E04644', '#B576AD'];
88

99
class App extends Component {
10-
constructor() {
11-
super();
12-
this.state = this.getInitialState();
13-
}
1410

15-
getInitialState() {
16-
return {
17-
selColorIdx: 0,
18-
guesses: [this.getNewGuess()],
19-
code: this.genCode()
20-
};
11+
INITIAL_STATE = {
12+
selColorIdx: 0,
13+
guesses: [this.getNewGuess()],
14+
code: this.genCode()
2115
}
2216

17+
state = this.INITIAL_STATE
18+
2319
getNewGuess() {
2420
return {
2521
code: [null, null, null, null],
@@ -45,7 +41,7 @@ class App extends Component {
4541
}
4642

4743
handleNewGameClick = () => {
48-
this.setState(this.getInitialState());
44+
this.setState(this.INITIAL_STATE);
4945
}
5046

5147
handlePegClick = (pegIdx) => {
@@ -149,7 +145,7 @@ class App extends Component {
149145
handleScoreClick={this.handleScoreClick}
150146
/>
151147
} />
152-
<Route exact path='/settings' render={props =>
148+
<Route exact path='/settings' render={props =>
153149
<SettingsPage {...props} />
154150
} />
155151
</Switch>

0 commit comments

Comments
 (0)