Files
bun-src/test/bundler/transpiler/react-compiler-fixtures/useCallback-maybe-modify-free-variable-dont-preserve-memoization-guarantee.js
2026-08-27 21:09:14 +00:00

24 lines
648 B
JavaScript

// @enablePreserveExistingMemoizationGuarantees:false @validateExhaustiveMemoizationDependencies:false
import {useCallback} from 'react';
import {identity, makeObject_Primitives, mutate, useHook} from 'shared-runtime';
function Component(props) {
const free = makeObject_Primitives();
const free2 = makeObject_Primitives();
const part = free2.part;
useHook();
const callback = useCallback(() => {
const x = makeObject_Primitives();
x.value = props.value;
mutate(x, free, part);
}, [props.value]);
mutate(free, part);
return callback;
}
export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{value: 42}],
};