useContext-maybe-mutate-context-in-callback.js — react Source File
Architecture documentation for useContext-maybe-mutate-context-in-callback.js, a javascript file in the react codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ba5104a1_ccad_2fad_d971_d47387d4c3bc["useContext-maybe-mutate-context-in-callback.js"] ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] ba5104a1_ccad_2fad_d971_d47387d4c3bc --> ac587885_e294_a1e9_b13f_5e7b920fdb42 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"] ba5104a1_ccad_2fad_d971_d47387d4c3bc --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05 style ba5104a1_ccad_2fad_d971_d47387d4c3bc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as React from 'react';
import {useContext} from 'react';
import {mutate} from 'shared-runtime';
const FooContext = React.createContext({current: null});
function Component(props) {
const Foo = useContext(FooContext);
// This callback can be memoized because we aren't 100% positive that
// `mutate()` actually mutates, so we optimistically assume it doesn't
// Its range doesn't get entagled w the useContext call so we're able
// to create a reactive scope and memoize it.
const onClick = () => {
mutate(Foo.current);
};
return <div onClick={onClick}>{props.children}</div>;
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{children: <div>Hello</div>}],
};
Domain
Subdomains
Functions
Dependencies
- react
- shared-runtime
Source
Frequently Asked Questions
What does useContext-maybe-mutate-context-in-callback.js do?
useContext-maybe-mutate-context-in-callback.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 useContext-maybe-mutate-context-in-callback.js?
useContext-maybe-mutate-context-in-callback.js defines 1 function(s): Component.
What does useContext-maybe-mutate-context-in-callback.js depend on?
useContext-maybe-mutate-context-in-callback.js imports 2 module(s): react, shared-runtime.
Where is useContext-maybe-mutate-context-in-callback.js in the architecture?
useContext-maybe-mutate-context-in-callback.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useContext-maybe-mutate-context-in-callback.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