createPropsProperties() — react Function Reference
Architecture documentation for the createPropsProperties() function in InlineJsxTransform.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD cfc7f24c_b40f_e5ce_0d06_07e1e5ca6c77["createPropsProperties()"] 5e75c578_acd8_79e6_2aae_0bb0b2c9ce77["InlineJsxTransform.ts"] cfc7f24c_b40f_e5ce_0d06_07e1e5ca6c77 -->|defined in| 5e75c578_acd8_79e6_2aae_0bb0b2c9ce77 876d58c8_bfce_a9d8_22c0_b40cc7e22553["inlineJsxTransform()"] 876d58c8_bfce_a9d8_22c0_b40cc7e22553 -->|calls| cfc7f24c_b40f_e5ce_0d06_07e1e5ca6c77 49446ae1_b830_9411_8258_1139d21b314b["createTemporaryPlace()"] cfc7f24c_b40f_e5ce_0d06_07e1e5ca6c77 -->|calls| 49446ae1_b830_9411_8258_1139d21b314b 041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"] cfc7f24c_b40f_e5ce_0d06_07e1e5ca6c77 -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e 53244187_914c_cc90_5880_7bfc1fc9c0bb["push()"] cfc7f24c_b40f_e5ce_0d06_07e1e5ca6c77 -->|calls| 53244187_914c_cc90_5880_7bfc1fc9c0bb style cfc7f24c_b40f_e5ce_0d06_07e1e5ca6c77 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/Optimization/InlineJsxTransform.ts lines 548–742
function createPropsProperties(
fn: HIRFunction,
instr: Instruction,
nextInstructions: Array<Instruction>,
propAttributes: Array<JsxAttribute>,
children: Array<Place> | null,
): {
refProperty: ObjectProperty;
keyProperty: ObjectProperty;
propsProperty: ObjectProperty;
} {
let refProperty: ObjectProperty | undefined;
let keyProperty: ObjectProperty | undefined;
const props: Array<ObjectProperty | SpreadPattern> = [];
const jsxAttributesWithoutKey = propAttributes.filter(
p => p.kind === 'JsxAttribute' && p.name !== 'key',
);
const jsxSpreadAttributes = propAttributes.filter(
p => p.kind === 'JsxSpreadAttribute',
);
const spreadPropsOnly =
jsxAttributesWithoutKey.length === 0 && jsxSpreadAttributes.length === 1;
propAttributes.forEach(prop => {
switch (prop.kind) {
case 'JsxAttribute': {
switch (prop.name) {
case 'key': {
keyProperty = {
kind: 'ObjectProperty',
key: {name: 'key', kind: 'string'},
type: 'property',
place: {...prop.place},
};
break;
}
case 'ref': {
/**
* In the current JSX implementation, ref is both
* a property on the element and a property on props.
*/
refProperty = {
kind: 'ObjectProperty',
key: {name: 'ref', kind: 'string'},
type: 'property',
place: {...prop.place},
};
const refPropProperty: ObjectProperty = {
kind: 'ObjectProperty',
key: {name: 'ref', kind: 'string'},
type: 'property',
place: {...prop.place},
};
props.push(refPropProperty);
break;
}
default: {
const attributeProperty: ObjectProperty = {
kind: 'ObjectProperty',
key: {name: prop.name, kind: 'string'},
type: 'property',
place: {...prop.place},
};
props.push(attributeProperty);
}
}
break;
}
case 'JsxSpreadAttribute': {
props.push({
kind: 'Spread',
place: {...prop.argument},
});
break;
}
}
});
const propsPropertyPlace = createTemporaryPlace(fn.env, instr.value.loc);
if (children) {
let childrenPropProperty: ObjectProperty;
if (children.length === 1) {
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does createPropsProperties() do?
createPropsProperties() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InlineJsxTransform.ts.
Where is createPropsProperties() defined?
createPropsProperties() is defined in compiler/packages/babel-plugin-react-compiler/src/Optimization/InlineJsxTransform.ts at line 548.
What does createPropsProperties() call?
createPropsProperties() calls 3 function(s): createTemporaryPlace, invariant, push.
What calls createPropsProperties()?
createPropsProperties() is called by 1 function(s): inlineJsxTransform.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free