Skip to content

Commit f1eab0f

Browse files
committed
Remove useCallback in custom useMousePosition hook
1 parent e83844b commit f1eab0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/_helpers/hooks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { useState, useCallback } from 'react';
1+
import { useState } from 'react';
22
import { getMousePosition } from './dom';
33

44
export const useMousePosition = (initialState = [0, 0], calcWidth, calcHeight) => {
55
const [position, changePosition] = useState(initialState);
6-
const setPosition = useCallback((e) => { // TODO: useCallback unnecessary?
6+
const setPosition = (e) => {
77
const [x, y] = getMousePosition(e, calcWidth, calcHeight);
88
if (x <= calcWidth && y <= calcHeight) {
99
changePosition([x, y]);
1010
} else changePosition([-1 * calcWidth, -1 * calcHeight]);
11-
});
11+
};
1212

1313
return [position, setPosition];
1414
};

0 commit comments

Comments
 (0)