We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e83844b commit f1eab0fCopy full SHA for f1eab0f
src/components/_helpers/hooks.js
@@ -1,14 +1,14 @@
1
-import { useState, useCallback } from 'react';
+import { useState } from 'react';
2
import { getMousePosition } from './dom';
3
4
export const useMousePosition = (initialState = [0, 0], calcWidth, calcHeight) => {
5
const [position, changePosition] = useState(initialState);
6
- const setPosition = useCallback((e) => { // TODO: useCallback unnecessary?
+ const setPosition = (e) => {
7
const [x, y] = getMousePosition(e, calcWidth, calcHeight);
8
if (x <= calcWidth && y <= calcHeight) {
9
changePosition([x, y]);
10
} else changePosition([-1 * calcWidth, -1 * calcHeight]);
11
- });
+ };
12
13
return [position, setPosition];
14
};
0 commit comments