@@ -200,8 +200,8 @@ First, add a constructor to the class to initialize the state:
200
200
201
201
` ` ` javascript{2 - 7 }
202
202
class Square extends React .Component {
203
- constructor () {
204
- super ();
203
+ constructor (props ) {
204
+ super (props );
205
205
this .state = {
206
206
value: null ,
207
207
};
@@ -228,8 +228,8 @@ Now the `<button>` tag looks like this:
228
228
229
229
` ` ` javascript{10 - 12 }
230
230
class Square extends React .Component {
231
- constructor () {
232
- super ();
231
+ constructor (props ) {
232
+ super (props );
233
233
this .state = {
234
234
value: null ,
235
235
};
@@ -282,8 +282,8 @@ Pulling state upwards like this is common when refactoring React components, so
282
282
283
283
` ` ` javascript{2 - 7 }
284
284
class Board extends React .Component {
285
- constructor () {
286
- super ();
285
+ constructor (props ) {
286
+ super (props );
287
287
this .state = {
288
288
squares: Array (9 ).fill (null ),
289
289
};
@@ -399,8 +399,8 @@ Try clicking a square – you should get an error because we haven't defined `ha
399
399
400
400
` ` ` javascript{9 - 13 }
401
401
class Board extends React .Component {
402
- constructor () {
403
- super ();
402
+ constructor (props ) {
403
+ super (props );
404
404
this .state = {
405
405
squares: Array (9 ).fill (null ),
406
406
};
@@ -528,8 +528,8 @@ Let's default the first move to be by 'X'. Modify our starting state in our Boar
528
528
529
529
` ` ` javascript{6 }
530
530
class Board extends React .Component {
531
- constructor () {
532
- super ();
531
+ constructor (props ) {
532
+ super (props );
533
533
this .state = {
534
534
squares: Array (9 ).fill (null ),
535
535
xIsNext: true ,
@@ -564,8 +564,8 @@ After these changes you should have this Board component:
564
564
565
565
` ` ` javascript{6 ,11 - 16 ,29 }
566
566
class Board extends React .Component {
567
- constructor () {
568
- super ();
567
+ constructor (props ) {
568
+ super (props );
569
569
this .state = {
570
570
squares: Array (9 ).fill (null ),
571
571
xIsNext: true ,
@@ -715,8 +715,8 @@ First, set up the initial state for Game by adding a constructor to it:
715
715
716
716
` ` ` javascript{2 - 10 }
717
717
class Game extends React .Component {
718
- constructor () {
719
- super ();
718
+ constructor (props ) {
719
+ super (props );
720
720
this .state = {
721
721
history: [{
722
722
squares: Array (9 ).fill (null ),
@@ -1006,8 +1006,8 @@ First, add `stepNumber: 0` to the initial state in Game's `constructor`:
1006
1006
1007
1007
```js{8}
1008
1008
class Game extends React.Component {
1009
- constructor () {
1010
- super ();
1009
+ constructor (props ) {
1010
+ super (props );
1011
1011
this .state = {
1012
1012
history: [{
1013
1013
squares: Array (9 ).fill (null ),
0 commit comments