How to use the react-debug-tools.inspectHooksOfFiber function in react-debug-tools

To help you get started, we’ve selected a few react-debug-tools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / react / packages / react-devtools-shared / src / backend / renderer.js View on Github external
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,

react-debug-tools

React package for debugging React trees.

MIT
Latest version published 6 years ago

Package Health Score

69 / 100
Full package analysis

Popular react-debug-tools functions