conditionally-return-fn.ts — react Source File
Architecture documentation for conditionally-return-fn.ts, a typescript file in the react codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 22d94a38_2839_d684_0cfc_4b37b29b0471["conditionally-return-fn.ts"] 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"] 22d94a38_2839_d684_0cfc_4b37b29b0471 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05 style 22d94a38_2839_d684_0cfc_4b37b29b0471 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import {createHookWrapper} from 'shared-runtime';
/**
* Assume that conditionally returned functions can be invoked and that their
* property loads are hoistable to the function declaration site.
*/
function useMakeCallback({
obj,
shouldMakeCb,
setState,
}: {
obj: {value: number};
shouldMakeCb: boolean;
setState: (newState: number) => void;
}) {
const cb = () => setState(obj.value);
if (shouldMakeCb) return cb;
else return null;
}
const setState = (arg: number) => {
'use no memo';
return arg;
};
export const FIXTURE_ENTRYPOINT = {
fn: createHookWrapper(useMakeCallback),
params: [{obj: {value: 1}, shouldMakeCb: true, setState}],
sequentialRenders: [
{obj: {value: 1}, shouldMakeCb: true, setState},
{obj: {value: 2}, shouldMakeCb: true, setState},
],
};
Domain
Subdomains
Functions
Dependencies
- shared-runtime
Source
Frequently Asked Questions
What does conditionally-return-fn.ts do?
conditionally-return-fn.ts is a source file in the react codebase, written in typescript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in conditionally-return-fn.ts?
conditionally-return-fn.ts defines 2 function(s): setState, useMakeCallback.
What does conditionally-return-fn.ts depend on?
conditionally-return-fn.ts imports 1 module(s): shared-runtime.
Where is conditionally-return-fn.ts in the architecture?
conditionally-return-fn.ts is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/assume-invoked/conditionally-return-fn.ts (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/assume-invoked).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free