Home / File/ try-catch-nullish-coalescing.js — react Source File

try-catch-nullish-coalescing.js — react Source File

Architecture documentation for try-catch-nullish-coalescing.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

function Component({a, b, fallback}) {
  try {
    // fallback.value is accessed WITHIN the ?? chain
    const result = a ?? b ?? fallback.value;
    return <span>{result}</span>;
  } catch {
    return <span>error</span>;
  }
}

export const FIXTURE_ENTRYPOINT = {
  fn: Component,
  params: [{a: 'first', b: 'second', fallback: {value: 'default'}}],
  sequentialRenders: [
    {a: 'first', b: 'second', fallback: {value: 'default'}},
    {a: 'first', b: 'second', fallback: {value: 'default'}},
    {a: null, b: 'second', fallback: {value: 'default'}},
    {a: null, b: null, fallback: {value: 'fallback'}},
    {a: undefined, b: undefined, fallback: {value: 'fallback'}},
    {a: 0, b: 'not zero', fallback: {value: 'default'}},
    {a: null, b: null, fallback: null}, // errors because fallback.value throws WITHIN the ?? chain
  ],
};

Subdomains

Functions

Frequently Asked Questions

What does try-catch-nullish-coalescing.js do?
try-catch-nullish-coalescing.js is a source file in the react codebase, written in javascript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in try-catch-nullish-coalescing.js?
try-catch-nullish-coalescing.js defines 1 function(s): Component.
Where is try-catch-nullish-coalescing.js in the architecture?
try-catch-nullish-coalescing.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-nullish-coalescing.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler).

Analyze Your Own Codebase

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

Try Supermodel Free