@@ -115,7 +115,7 @@ ReactDOM.render(
115
115
< Square black>
116
116
< Knight / >
117
117
< / Square> ,
118
- document .getElementById (' root' ),
118
+ document .getElementById (' root' )
119
119
)
120
120
```
121
121
@@ -140,7 +140,7 @@ export default function Square({ black, children }) {
140
140
backgroundColor: fill,
141
141
color: stroke,
142
142
width: ' 100%' ,
143
- height: ' 100%' ,
143
+ height: ' 100%'
144
144
}}
145
145
>
146
146
{children}
@@ -178,7 +178,7 @@ import Board from './Board'
178
178
179
179
ReactDOM .render (
180
180
< Board knightPosition= {[0 , 0 ]} / > ,
181
- document .getElementById (' root' ),
181
+ document .getElementById (' root' )
182
182
)
183
183
```
184
184
@@ -206,7 +206,7 @@ export default function Board({ knightPosition }) {
206
206
< div
207
207
style= {{
208
208
width: ' 100%' ,
209
- height: ' 100%' ,
209
+ height: ' 100%'
210
210
}}
211
211
>
212
212
{renderSquare (0 , 0 , knightPosition)}
@@ -252,7 +252,7 @@ export default function Board({ knightPosition }) {
252
252
width: ' 100%' ,
253
253
height: ' 100%' ,
254
254
display: ' flex' ,
255
- flexWrap: ' wrap' ,
255
+ flexWrap: ' wrap'
256
256
}}
257
257
>
258
258
{squares}
@@ -274,7 +274,7 @@ import Board from './Board'
274
274
275
275
ReactDOM .render (
276
276
< Board knightPosition= {[7 , 4 ]} / > ,
277
- document .getElementById (' root' ),
277
+ document .getElementById (' root' )
278
278
)
279
279
```
280
280
@@ -302,8 +302,8 @@ import { observe } from './Game'
302
302
303
303
const root = document .getElementById (' root' )
304
304
305
- observe (knightPosition =>
306
- ReactDOM .render (< Board knightPosition= {knightPosition} / > , root),
305
+ observe (( knightPosition ) =>
306
+ ReactDOM .render (< Board knightPosition= {knightPosition} / > , root)
307
307
)
308
308
```
309
309
@@ -446,7 +446,7 @@ Next, I'm going to create the constants for the draggable item types. We're only
446
446
447
447
``` jsx
448
448
export const ItemTypes = {
449
- KNIGHT : ' knight' ,
449
+ KNIGHT : ' knight'
450
450
}
451
451
```
452
452
@@ -459,9 +459,9 @@ The [`useDrag`](/docs/api/use-drag) hook accepts a specification object. In this
459
459
``` jsx
460
460
const [{ isDragging }, drag ] = useDrag ({
461
461
item: { type: ItemTypes .KNIGHT },
462
- collect : monitor => ({
463
- isDragging: !! monitor .isDragging (),
464
- }),
462
+ collect : ( monitor ) => ({
463
+ isDragging: !! monitor .isDragging ()
464
+ })
465
465
})
466
466
```
467
467
@@ -558,7 +558,7 @@ Let's now wrap the `BoardSquare` with a [`useDrop`](/docs/api/use-drop) hook. I'
558
558
``` jsx
559
559
const [, drop ] = useDrop ({
560
560
accept: ItemTypes .KNIGHT ,
561
- drop : () => moveKnight (x, y),
561
+ drop : () => moveKnight (x, y)
562
562
})
563
563
```
564
564
@@ -570,10 +570,10 @@ In my collecting function I'm going to ask the monitor whether the pointer is cu
570
570
const [{ isOver , canDrop }, drop ] = useDrop ({
571
571
accept: ItemTypes .KNIGHT ,
572
572
drop : () => moveKnight (x, y),
573
- collect : mon => ({
573
+ collect : ( mon ) => ({
574
574
isOver: !! mon .isOver (),
575
- canDrop: !! mon .canDrop (),
576
- }),
575
+ canDrop: !! mon .canDrop ()
576
+ })
577
577
})
578
578
```
579
579
@@ -638,10 +638,10 @@ const [{ isOver, canDrop }, drop] = useDrop({
638
638
accept: ItemTypes .KNIGHT ,
639
639
canDrop : () => canMoveKnight (x, y),
640
640
drop : () => moveKnight (x, y),
641
- collect : monitor => ({
641
+ collect : ( monitor ) => ({
642
642
isOver: !! monitor .isOver (),
643
- canDrop: !! monitor .canDrop (),
644
- }),
643
+ canDrop: !! monitor .canDrop ()
644
+ })
645
645
})
646
646
```
647
647
@@ -697,9 +697,9 @@ We are lucky again, because it is easy to do with React DnD. We just need to use
697
697
``` jsx
698
698
const [{ isDragging }, drag , preview ] = useDrag ({
699
699
item: { type: ItemTypes .KNIGHT },
700
- collect : monitor => ({
701
- isDragging: !! monitor .isDragging (),
702
- }),
700
+ collect : ( monitor ) => ({
701
+ isDragging: !! monitor .isDragging ()
702
+ })
703
703
})
704
704
```
705
705
0 commit comments