ComponentWithCustomHook.js — react Source File
Architecture documentation for ComponentWithCustomHook.js, a javascript file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 79057a9d_fd67_ee74_5a04_2e547d02f7c1["ComponentWithCustomHook.js"] ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 79057a9d_fd67_ee74_5a04_2e547d02f7c1 --> ac587885_e294_a1e9_b13f_5e7b920fdb42 style 79057a9d_fd67_ee74_5a04_2e547d02f7c1 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, {useDebugValue, useEffect, useState} from 'react';
export function Component() {
const [count, setCount] = useState(0);
const isDarkMode = useIsDarkMode();
const {foo} = useFoo();
useEffect(() => {
// ...
}, []);
const handleClick = () => setCount(count + 1);
return (
<>
<div>Dark mode? {isDarkMode}</div>
<div>Count: {count}</div>
<div>Foo: {foo}</div>
<button onClick={handleClick}>Update count</button>
</>
);
}
function useIsDarkMode() {
const [isDarkMode] = useState(false);
useEffect(function useEffectCreate() {
// Here is where we may listen to a "theme" event...
}, []);
return isDarkMode;
}
function useFoo() {
useDebugValue('foo');
return {foo: true};
}
Domain
Subdomains
Functions
Dependencies
- react
Source
Frequently Asked Questions
What does ComponentWithCustomHook.js do?
ComponentWithCustomHook.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 ComponentWithCustomHook.js?
ComponentWithCustomHook.js defines 3 function(s): Component, useFoo, useIsDarkMode.
What does ComponentWithCustomHook.js depend on?
ComponentWithCustomHook.js imports 1 module(s): react.
Where is ComponentWithCustomHook.js in the architecture?
ComponentWithCustomHook.js is located at packages/react-devtools-shared/src/hooks/__tests__/__source__/ComponentWithCustomHook.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