@@ -14,8 +14,8 @@ export default class ReactHover extends Component {
14
14
constructor ( props ) {
15
15
super ( props )
16
16
this . state = {
17
- triggerComponentStyle : this . props . styles . trigger ,
18
- hoverComponentStyle : this . props . styles . hoverComponent
17
+ triggerComponentStyle : props . styles . trigger ,
18
+ hoverComponentStyle : props . styles . hoverComponent
19
19
}
20
20
}
21
21
@@ -42,9 +42,9 @@ export default class ReactHover extends Component {
42
42
let { hoverComponentStyle } = this . state
43
43
let updatedStyles = null
44
44
if ( flag ) {
45
- updatedStyles = Object . assign ( { } , hoverComponentStyle , { display : 'block' } )
45
+ updatedStyles = { ... hoverComponentStyle , display : 'block' }
46
46
} else {
47
- updatedStyles = Object . assign ( { } , hoverComponentStyle , { display : 'none' } )
47
+ updatedStyles = { ... hoverComponentStyle , display : 'none' }
48
48
}
49
49
this . setState ( {
50
50
hoverComponentStyle : updatedStyles
@@ -55,18 +55,18 @@ export default class ReactHover extends Component {
55
55
const cursorX = e . pageX
56
56
const cursorY = e . pageY
57
57
let { options : { followCursor, shiftX, shiftY } } = this . props
58
- const { hoverComponentStyle } = this . state
58
+ let { hoverComponentStyle } = this . state
59
59
let updatedStyles = null
60
60
if ( ! followCursor ) {
61
61
return
62
62
}
63
- if ( shiftX == NaN ) {
63
+ if ( isNaN ( shiftX ) ) {
64
64
shiftX = 0
65
65
}
66
- if ( shiftY == NaN ) {
66
+ if ( isNaN ( shiftY ) ) {
67
67
shiftY = 0
68
68
}
69
- updatedStyles = Object . assign ( { } , hoverComponentStyle , { top : cursorY + shiftY , left : cursorX + shiftX } )
69
+ updatedStyles = { ... hoverComponentStyle , top : cursorY + shiftY , left : cursorX + shiftX }
70
70
this . setState ( {
71
71
hoverComponentStyle : updatedStyles
72
72
} )
0 commit comments