Home / File/ ComponentUsingHooksIndirectly.js — react Source File

ComponentUsingHooksIndirectly.js — react Source File

Architecture documentation for ComponentUsingHooksIndirectly.js, a javascript file in the react codebase. 1 imports, 0 dependents.

File javascript BabelCompiler Validation 1 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  4fc61ecb_b092_e627_84fe_2f8c4c8723ee["ComponentUsingHooksIndirectly.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  4fc61ecb_b092_e627_84fe_2f8c4c8723ee --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  style 4fc61ecb_b092_e627_84fe_2f8c4c8723ee 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 React, {useEffect, useState} from 'react';

export function Component() {
  const countState = useState(0);
  const count = countState[0];
  const setCount = countState[1];

  const darkMode = useIsDarkMode();
  const [isDarkMode] = darkMode;

  useEffect(() => {
    // ...
  }, []);

  const handleClick = () => setCount(count + 1);

  return (
    <>
      <div>Dark mode? {isDarkMode}</div>
      <div>Count: {count}</div>
      <button onClick={handleClick}>Update count</button>
    </>
  );
}

function useIsDarkMode() {
  const darkModeState = useState(false);
  const [isDarkMode] = darkModeState;

  useEffect(function useEffectCreate() {
    // Here is where we may listen to a "theme" event...
  }, []);

  return [isDarkMode, () => {}];
}

Domain

Subdomains

Dependencies

  • react

Frequently Asked Questions

What does ComponentUsingHooksIndirectly.js do?
ComponentUsingHooksIndirectly.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 ComponentUsingHooksIndirectly.js?
ComponentUsingHooksIndirectly.js defines 2 function(s): Component, useIsDarkMode.
What does ComponentUsingHooksIndirectly.js depend on?
ComponentUsingHooksIndirectly.js imports 1 module(s): react.
Where is ComponentUsingHooksIndirectly.js in the architecture?
ComponentUsingHooksIndirectly.js is located at packages/react-devtools-shared/src/hooks/__tests__/__source__/ComponentUsingHooksIndirectly.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/hooks/__tests__/__source__).

Analyze Your Own Codebase

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

Try Supermodel Free