Home / Function/ InspectedElementPropsTree() — react Function Reference

InspectedElementPropsTree() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0c87191a_5cd0_19e9_6a78_c4e93b9472e3["InspectedElementPropsTree()"]
  816abfef_4d5d_bc7e_fc00_1acadf628d28["InspectedElementPropsTree.js"]
  0c87191a_5cd0_19e9_6a78_c4e93b9472e3 -->|defined in| 816abfef_4d5d_bc7e_fc00_1acadf628d28
  24a5b0f3_4e3a_ff70_e4ed_c4392045f885["serializeDataForCopy()"]
  0c87191a_5cd0_19e9_6a78_c4e93b9472e3 -->|calls| 24a5b0f3_4e3a_ff70_e4ed_c4392045f885
  style 0c87191a_5cd0_19e9_6a78_c4e93b9472e3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/devtools/views/Components/InspectedElementPropsTree.js lines 38–123

export default function InspectedElementPropsTree({
  bridge,
  element,
  inspectedElement,
  store,
}: Props): React.Node {
  const {readOnly} = React.useContext(OptionsContext);

  const {
    canEditFunctionProps,
    canEditFunctionPropsDeletePaths,
    canEditFunctionPropsRenamePaths,
    props,
    type,
  } = inspectedElement;

  const canDeletePaths =
    type === ElementTypeClass || canEditFunctionPropsDeletePaths;
  const canEditValues =
    !readOnly &&
    (type === ElementTypeClass || canEditFunctionProps) &&
    // Make it read-only for Suspense to make it a bit cleaner. It's not
    // useful to edit children anyway.
    type !== ElementTypeSuspense &&
    type !== ElementTypeActivity;
  const canRenamePaths =
    type === ElementTypeClass || canEditFunctionPropsRenamePaths;

  // Skip the section for null props.
  if (props == null) {
    return null;
  }

  const entries = Object.entries(props);
  entries.sort(alphaSortEntries);
  const isEmpty = entries.length === 0;

  const handleCopy = withPermissionsCheck(
    {permissions: ['clipboardWrite']},
    () => copy(serializeDataForCopy(props)),
  );

  return (
    <div data-testname="InspectedElementPropsTree">
      <div className={styles.HeaderRow}>
        <div className={styles.Header}>props</div>
        {!isEmpty && (
          <Button onClick={handleCopy} title="Copy to clipboard">
            <ButtonIcon type="copy" />
          </Button>
        )}
      </div>
      {!isEmpty &&
        entries.map(([name, value]) => (
          <KeyValue
            key={name}
            alphaSort={true}
            bridge={bridge}
            canDeletePaths={canDeletePaths}
            canEditValues={canEditValues}
            canRenamePaths={canRenamePaths}
            depth={1}
            element={element}
            hidden={false}
            inspectedElement={inspectedElement}
            name={name}
            path={[name]}
            pathRoot="props"
            store={store}
            value={value}
          />
        ))}
      {canEditValues && (
        <NewKeyValue
          bridge={bridge}
          depth={0}
          hidden={false}
          inspectedElement={inspectedElement}
          path={[]}
          store={store}
          type="props"

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free