prevent unused exec getCurrentValue after re-render (#22442)
Behnam Mohammadi committed
Sep 28, 2021 at 00:50 UTC
8131de13e29ba626dfd311c2b4e9bb42fa4d5d6c
1 file changed
+2
-2
packages/react-devtools-shared/src/devtools/views/hooks.js
+2
-2
@@ -264,11 +264,11 @@ export function useSubscription<Value>({
264
getCurrentValue: () => Value,
265
subscribe: (callback: Function) => () => void,
266
|}): Value {
267
- const [state, setState] = useState({
267
+ const [state, setState] = useState(() => ({
268
getCurrentValue,
269
subscribe,
270
value: getCurrentValue(),
271
- });
271
+ }));
272
273
if (
274
state.getCurrentValue !== getCurrentValue ||