Home / File/ CodeEditorByDefault.js — react Source File

CodeEditorByDefault.js — react Source File

Architecture documentation for CodeEditorByDefault.js, a javascript file in the react codebase. 4 imports, 2 dependents.

File javascript BabelCompiler Validation 4 imports 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  d31d8c6c_50ef_6d6a_4682_cdf66edc0ca0["CodeEditorByDefault.js"]
  bcb71f5e_1ecf_5620_9a9e_55d6ab61dd1f["constants.js"]
  d31d8c6c_50ef_6d6a_4682_cdf66edc0ca0 --> bcb71f5e_1ecf_5620_9a9e_55d6ab61dd1f
  315baf50_1028_51ca_a9c1_679c6a17ed98["hooks.js"]
  d31d8c6c_50ef_6d6a_4682_cdf66edc0ca0 --> 315baf50_1028_51ca_a9c1_679c6a17ed98
  3c0f989f_424c_e338_72c3_e8bc259ca04f["SettingsShared.css"]
  d31d8c6c_50ef_6d6a_4682_cdf66edc0ca0 --> 3c0f989f_424c_e338_72c3_e8bc259ca04f
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  d31d8c6c_50ef_6d6a_4682_cdf66edc0ca0 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  6b10ae9e_a560_a310_ddb0_99f0d8e5ab0c["EditorPane.js"]
  6b10ae9e_a560_a310_ddb0_99f0d8e5ab0c --> d31d8c6c_50ef_6d6a_4682_cdf66edc0ca0
  ba1321bc_42b8_c6c2_e944_8928bf07c59a["GeneralSettings.js"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> d31d8c6c_50ef_6d6a_4682_cdf66edc0ca0
  style d31d8c6c_50ef_6d6a_4682_cdf66edc0ca0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import * as React from 'react';
import {LOCAL_STORAGE_ALWAYS_OPEN_IN_EDITOR} from '../../../constants';
import {useLocalStorage} from '../hooks';

import styles from './SettingsShared.css';

export default function CodeEditorByDefault({
  onChange,
}: {
  onChange?: boolean => void,
}): React.Node {
  const [alwaysOpenInEditor, setAlwaysOpenInEditor] = useLocalStorage<boolean>(
    LOCAL_STORAGE_ALWAYS_OPEN_IN_EDITOR,
    false,
  );

  return (
    <label className={styles.SettingRow}>
      <input
        type="checkbox"
        checked={alwaysOpenInEditor}
        onChange={({currentTarget}) => {
          setAlwaysOpenInEditor(currentTarget.checked);
          if (onChange) {
            onChange(currentTarget.checked);
          }
        }}
        className={styles.SettingRowCheckbox}
      />
      Open local files directly in your code editor
    </label>
  );
}

Domain

Subdomains

Frequently Asked Questions

What does CodeEditorByDefault.js do?
CodeEditorByDefault.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in CodeEditorByDefault.js?
CodeEditorByDefault.js defines 1 function(s): CodeEditorByDefault.
What does CodeEditorByDefault.js depend on?
CodeEditorByDefault.js imports 4 module(s): SettingsShared.css, constants.js, hooks.js, react.
What files import CodeEditorByDefault.js?
CodeEditorByDefault.js is imported by 2 file(s): EditorPane.js, GeneralSettings.js.
Where is CodeEditorByDefault.js in the architecture?
CodeEditorByDefault.js is located at packages/react-devtools-shared/src/devtools/views/Settings/CodeEditorByDefault.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views/Settings).

Analyze Your Own Codebase

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

Try Supermodel Free