Home / Function/ CopySourceButton() — react Function Reference

CopySourceButton() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  13b07ebb_026a_8fe5_8e98_65bf528f7d7b["CopySourceButton()"]
  50c39210_7831_dde4_3a12_fc8ea644bc38["InspectedElementSourcePanel.js"]
  13b07ebb_026a_8fe5_8e98_65bf528f7d7b -->|defined in| 50c39210_7831_dde4_3a12_fc8ea644bc38
  style 13b07ebb_026a_8fe5_8e98_65bf528f7d7b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSourcePanel.js lines 68–95

function CopySourceButton({source, symbolicatedSourcePromise}: Props) {
  const symbolicatedSource = React.use(symbolicatedSourcePromise);
  if (symbolicatedSource == null) {
    const [, sourceURL, line, column] = source;
    const handleCopy = withPermissionsCheck(
      {permissions: ['clipboardWrite']},
      () => copy(`${sourceURL}:${line}:${column}`),
    );

    return (
      <Button onClick={handleCopy} title="Copy to clipboard">
        <ButtonIcon type="copy" />
      </Button>
    );
  }

  const [, sourceURL, line, column] = symbolicatedSource.location;
  const handleCopy = withPermissionsCheck(
    {permissions: ['clipboardWrite']},
    () => copy(`${sourceURL}:${line}:${column}`),
  );

  return (
    <Button onClick={handleCopy} title="Copy to clipboard">
      <ButtonIcon type="copy" />
    </Button>
  );
}

Domain

Subdomains

Frequently Asked Questions

What does CopySourceButton() do?
CopySourceButton() is a function in the react codebase, defined in packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSourcePanel.js.
Where is CopySourceButton() defined?
CopySourceButton() is defined in packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSourcePanel.js at line 68.

Analyze Your Own Codebase

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

Try Supermodel Free