Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let hooks = null;
if (usesHooks) {
const originalConsoleMethods = {};
// Temporarily disable all console logging before re-running the hook.
for (let method in console) {
try {
originalConsoleMethods[method] = console[method];
// $FlowFixMe property error|warn is not writable.
console[method] = () => {};
} catch (error) {}
}
try {
hooks = inspectHooksOfFiber(
fiber,
(renderer.currentDispatcherRef: any),
);
} finally {
// Restore original console functionality.
for (let method in originalConsoleMethods) {
try {
// $FlowFixMe property error|warn is not writable.
console[method] = originalConsoleMethods[method];
} catch (error) {}
}
}
}
return {
id,