try-catch-multiple-value-blocks.js — react Source File
Architecture documentation for try-catch-multiple-value-blocks.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
function Component({a, b, cond, items}) {
try {
const x = a?.value;
// items.length is accessed WITHIN the ternary expression - throws if items is null
const y = cond ? b?.first : items.length;
const z = x && y;
return (
<div>
{String(x)}-{String(y)}-{String(z)}
</div>
);
} catch {
return <div>error</div>;
}
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [
{
a: {value: 'A'},
b: {first: 'B1', second: 'B2'},
cond: true,
items: [1, 2, 3],
},
],
sequentialRenders: [
{
a: {value: 'A'},
b: {first: 'B1', second: 'B2'},
cond: true,
items: [1, 2, 3],
},
{
a: {value: 'A'},
b: {first: 'B1', second: 'B2'},
cond: true,
items: [1, 2, 3],
},
{
a: {value: 'A'},
b: {first: 'B1', second: 'B2'},
cond: false,
items: [1, 2],
},
{a: null, b: {first: 'B1', second: 'B2'}, cond: true, items: [1, 2, 3]},
{a: {value: 'A'}, b: null, cond: true, items: [1, 2, 3]}, // b?.first is safe (returns undefined)
{a: {value: 'A'}, b: {first: 'B1', second: 'B2'}, cond: false, items: null}, // errors because items.length throws when cond=false
{
a: {value: ''},
b: {first: 'B1', second: 'B2'},
cond: true,
items: [1, 2, 3, 4],
},
],
};
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does try-catch-multiple-value-blocks.js do?
try-catch-multiple-value-blocks.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-multiple-value-blocks.js?
try-catch-multiple-value-blocks.js defines 1 function(s): Component.
Where is try-catch-multiple-value-blocks.js in the architecture?
try-catch-multiple-value-blocks.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-multiple-value-blocks.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