Files
bun-src/test/bundler/transpiler/react-compiler-fixtures/allow-global-mutation-unused-usecallback.expect.md
T
2026-08-27 21:09:14 +00:00

776 B

Input

import {useCallback, useEffect, useState} from 'react';

function Component() {
  const callback = useCallback(() => {
    window.foo = true;
  }, []);

  return <div>Ok</div>;
}

export const FIXTURE_ENTRYPOINT = {
  fn: Component,
  params: [{}],
};

Code

import { c as _c } from "react/compiler-runtime";
import { useCallback, useEffect, useState } from "react";

function Component() {
  const $ = _c(1);
  let t0;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t0 = <div>Ok</div>;
    $[0] = t0;
  } else {
    t0 = $[0];
  }
  return t0;
}
function _temp() {
  window.foo = true;
}

export const FIXTURE_ENTRYPOINT = {
  fn: Component,
  params: [{}],
};

Eval output

(kind: ok)

Ok