testReactApiThatRendersAnywhere

tcmts.cli.placement.testReactApiThatRendersAnywhere · #oruwkep2 · term

React's hooks are what make a component render in the browser; the react library's match and <Stylesheet> render anywhere, placed by their code as any library's are (testLibrariesTcmShips sees them so).

import { isClientReactApi } from "#codebase/tcmts/cli/placement";
import assert from "node:assert/strict";

export const testReactApiThatRendersAnywhere = () => {
  assert.equal(isClientReactApi({ module: "npm:react@^19.0.0", export: "useState" }), true);
  assert.equal(isClientReactApi({ module: "npm:react-dom@^19.0.0", export: "createPortal" }), true);
  assert.equal(isClientReactApi({ module: "npm:react@^19.0.0", export: "Suspense" }), false);
  assert.equal(isClientReactApi({ module: "tcm:react", export: "useLocation" }), false);
}

uses