Home / Function/ InspectedElementWrapper() — react Function Reference

InspectedElementWrapper() — react Function Reference

Architecture documentation for the InspectedElementWrapper() function in InspectedElement.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  07c306bf_14f4_0687_f161_c16874f999aa["InspectedElementWrapper()"]
  4c0d725a_27bd_a723_3599_a3e75bea5bd3["InspectedElement.js"]
  07c306bf_14f4_0687_f161_c16874f999aa -->|defined in| 4c0d725a_27bd_a723_3599_a3e75bea5bd3
  19776675_fb50_d3e9_2e67_e3dcc7805e1e["useEditorURL()"]
  07c306bf_14f4_0687_f161_c16874f999aa -->|calls| 19776675_fb50_d3e9_2e67_e3dcc7805e1e
  style 07c306bf_14f4_0687_f161_c16874f999aa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/devtools/views/Components/InspectedElement.js lines 47–341

export default function InspectedElementWrapper({
  actionButtons,
  fallbackEmpty,
}: Props): React.Node {
  const {inspectedElementID} = useContext(TreeStateContext);
  const bridge = useContext(BridgeContext);
  const store = useContext(StoreContext);
  const {
    hideToggleErrorAction,
    hideToggleSuspenseAction,
    hideLogAction,
    hideViewSourceAction,
  } = useContext(OptionsContext);

  const {hookNames, inspectedElement, parseHookNames, toggleParseHookNames} =
    useContext(InspectedElementContext);

  const fetchFileWithCaching = useContext(FetchFileWithCachingContext);

  const source =
    inspectedElement == null
      ? null
      : inspectedElement.source != null
        ? inspectedElement.source
        : inspectedElement.stack != null && inspectedElement.stack.length > 0
          ? inspectedElement.stack[0]
          : null;

  const symbolicatedSourcePromise: Promise<SourceMappedLocation | null> =
    React.useMemo(() => {
      if (fetchFileWithCaching == null) return noSourcePromise;

      if (source == null) return noSourcePromise;

      const [, sourceURL, line, column] = source;
      return symbolicateSourceWithCache(
        fetchFileWithCaching,
        sourceURL,
        line,
        column,
      );
    }, [source]);

  const element =
    inspectedElementID !== null
      ? store.getElementByID(inspectedElementID)
      : null;

  const highlightElement = useCallback(() => {
    if (element !== null && inspectedElementID !== null) {
      const rendererID = store.getRendererIDForElement(inspectedElementID);
      if (rendererID !== null) {
        bridge.send('highlightHostInstance', {
          displayName: element.displayName,
          hideAfterTimeout: true,
          id: inspectedElementID,
          openBuiltinElementsPanel: true,
          rendererID,
          scrollIntoView: true,
        });
      }
    }
  }, [bridge, element, inspectedElementID, store]);

  const logElement = useCallback(() => {
    if (inspectedElementID !== null) {
      const rendererID = store.getRendererIDForElement(inspectedElementID);
      if (rendererID !== null) {
        bridge.send('logElementToConsole', {
          id: inspectedElementID,
          rendererID,
        });
      }
    }
  }, [bridge, inspectedElementID, store]);

  const isErrored = inspectedElement != null && inspectedElement.isErrored;

  const isSuspended =
    element !== null &&
    element.type === ElementTypeSuspense &&

Domain

Subdomains

Frequently Asked Questions

What does InspectedElementWrapper() do?
InspectedElementWrapper() is a function in the react codebase, defined in packages/react-devtools-shared/src/devtools/views/Components/InspectedElement.js.
Where is InspectedElementWrapper() defined?
InspectedElementWrapper() is defined in packages/react-devtools-shared/src/devtools/views/Components/InspectedElement.js at line 47.
What does InspectedElementWrapper() call?
InspectedElementWrapper() calls 1 function(s): useEditorURL.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free