repro-returned-inner-fn-reassigns-context.js — react Source File
Architecture documentation for repro-returned-inner-fn-reassigns-context.js, a javascript file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 1ff2afbf_1e45_1cf1_8ff6_9cf4c73d3e10["repro-returned-inner-fn-reassigns-context.js"] 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"] 1ff2afbf_1e45_1cf1_8ff6_9cf4c73d3e10 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05 style 1ff2afbf_1e45_1cf1_8ff6_9cf4c73d3e10 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import {makeArray, Stringify, useIdentity} from 'shared-runtime';
/**
* Example showing that returned inner function expressions should not be
* typed with `freeze` effects.
* Also see repro-returned-inner-fn-mutates-context
*/
function Foo({b}) {
'use memo';
const fnFactory = () => {
/**
* This returned function expression *is* a local value. But it might (1)
* capture and mutate its context environment and (2) be called during
* render.
* Typing it with `freeze` effects would be incorrect as it would mean
* inferring that calls to updaterFactory()() do not mutate its captured
* context.
*/
return () => {
myVar = () => console.log('a');
};
};
let myVar = () => console.log('b');
useIdentity();
const fn = fnFactory();
const arr = makeArray(b);
fn(arr);
return <Stringify cb={myVar} value={arr} shouldInvokeFns={true} />;
}
export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{b: 1}],
sequentialRenders: [{b: 1}, {b: 2}],
};
Domain
Subdomains
Functions
Dependencies
- shared-runtime
Source
Frequently Asked Questions
What does repro-returned-inner-fn-reassigns-context.js do?
repro-returned-inner-fn-reassigns-context.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 repro-returned-inner-fn-reassigns-context.js?
repro-returned-inner-fn-reassigns-context.js defines 1 function(s): Foo.
What does repro-returned-inner-fn-reassigns-context.js depend on?
repro-returned-inner-fn-reassigns-context.js imports 1 module(s): shared-runtime.
Where is repro-returned-inner-fn-reassigns-context.js in the architecture?
repro-returned-inner-fn-reassigns-context.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-returned-inner-fn-reassigns-context.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