Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in derived-state-from-prop-local-state-and-component-scope.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  3f588b7f_8689_d9bf_7e2f_0cbd5101cefc["Component()"]
  22310930_7e1f_1eec_9d5b_e0945bc73ec7["derived-state-from-prop-local-state-and-component-scope.js"]
  3f588b7f_8689_d9bf_7e2f_0cbd5101cefc -->|defined in| 22310930_7e1f_1eec_9d5b_e0945bc73ec7
  style 3f588b7f_8689_d9bf_7e2f_0cbd5101cefc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/derived-state-from-prop-local-state-and-component-scope.js lines 4–20

function Component({firstName}) {
  const [lastName, setLastName] = useState('Doe');
  const [fullName, setFullName] = useState('John');

  const middleName = 'D.';

  useEffect(() => {
    setFullName(firstName + ' ' + middleName + ' ' + lastName);
  }, [firstName, middleName, lastName]);

  return (
    <div>
      <input value={lastName} onChange={e => setLastName(e.target.value)} />
      <div>{fullName}</div>
    </div>
  );
}

Subdomains

Frequently Asked Questions

What does Component() do?
Component() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/derived-state-from-prop-local-state-and-component-scope.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/derived-state-from-prop-local-state-and-component-scope.js at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free