サンプル
react 19.2.8: useEffect
検証済みサンプル — npm react 19.2.8: useEffect. node 22 · linux alpine/x64 · docker で contract を実行し、成功しました: react package.json declares export mappings for client…
sha256:91a4b2f23a5324c2474b6c9e96de75ebaa1ed7f2a493db6f6ef0d4a91ae7b07a
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-26 |
ケース
HOW- ゴール
- verify react.useEffect in pkg:npm/react@19.2.8
- パッケージ
- シンボル
-
- react.useEffect
- 環境
- node 22.23.2
- 作成日
- 2026-08-26T08:07:35Z
コントラクト
- react package.json declares export mappings for client and react-server entries at version 19.2.8
- react exports useEffect as a function on the default client runtime interface
- react useEffect throws a TypeError when invoked outside an active component render dispatcher
- react useEffect delegates setup callback and dependencies to the active ReactCurrentDispatcher
- react useEffect supports empty dependency arrays and omitted dependencies passing them to the dispatcher
- react react-server entry explicitly omits useEffect export in server component environments
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
ソース
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify react.useEffect in pkg:npm/react@19.2.8
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react@19.2.8
Demonstrate these symbols/APIs:
- react.useEffect
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:2b6a8f7ce6f5ffd2466facba62575a958115792146fbe0f6caf91ae691ef794c","contract":["react package.json declares export mappings for client and react-server entries at version 19.2.8","react exports useEffect as a function on the default client runtime interface","react useEffect throws a TypeError when invoked outside an active component render dispatcher","react useEffect delegates setup callback and dependencies to the active ReactCurrentDispatcher","react useEffect supports empty dependency arrays and omitted dependencies passing them to the dispatcher","react react-server entry explicitly omits useEffect export in server component environments"],"goal":"verify react.useEffect in pkg:npm/react@19.2.8","kind":"HOW","packages":["pkg:npm/react@19.2.8"],"schemaVersion":1,"symbols":["react.useEffect"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/react@19.2.8"],"schemaVersion":1,"subject":"pkg:npm/react@19.2.8","symbols":["react.useEffect"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-use-effect",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-use-effect",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"react": "19.2.8"
}
},
"node_modules/react": {
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz",
"integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
}
}
}
{
"name": "sample-react-use-effect",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"dependencies": {
"react": "19.2.8"
}
}
{
"schemaVersion": 1,
"goal": "verify react.useEffect in pkg:npm/react@19.2.8",
"kind": "HOW",
"packages": [
"pkg:npm/react@19.2.8"
],
"symbols": [
"react.useEffect"
]
}
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { createRequire } from 'node:module';
import React from 'react';
const require = createRequire(import.meta.url);
// Contract 1: react package.json declares export mappings for client and react-server entries at version 19.2.8
{
const pkgJsonPath = require.resolve('react/package.json');
assert.ok(fs.existsSync(pkgJsonPath));
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
assert.strictEqual(pkgJson.name, 'react');
assert.strictEqual(pkgJson.version, '19.2.8');
assert.strictEqual(pkgJson.exports['.']['default'], './index.js');
assert.strictEqual(pkgJson.exports['.']['react-server'], './react.react-server.js');
}
// Contract 2: react exports useEffect as a function on the default client runtime interface
{
assert.strictEqual(typeof React.useEffect, 'function');
assert.strictEqual(React.version, '19.2.8');
}
// Contract 3: react useEffect throws a TypeError when invoked outside an active component render dispatcher
{
const internals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
assert.ok(internals && typeof internals === 'object');
assert.strictEqual(internals.H, null);
assert.throws(
() => {
React.useEffect(() => {});
},
{
name: 'TypeError'
}
);
}
// Contract 4: react useEffect delegates setup callback and dependencies to the active ReactCurrentDispatcher
{
const internals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
let receivedCall = null;
const mockReturn = { __registered: true };
internals.H = {
useEffect(create, deps) {
receivedCall = { create, deps };
return mockReturn;
}
};
try {
const effectCallback = () => {};
const deps = ['item1', 42, true];
const result = React.useEffect(effectCallback, deps);
assert.strictEqual(result, mockReturn);
assert.ok(receivedCall !== null);
assert.strictEqual(receivedCall.create, effectCallback);
assert.strictEqual(receivedCall.deps, deps);
} finally {
internals.H = null;
}
}
// Contract 5: react useEffect supports empty dependency arrays and omitted dependencies passing them to the dispatcher
{
const internals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
let receivedCalls = [];
internals.H = {
useEffect(create, deps) {
receivedCalls.push({ create, deps });
}
};
try {
const fn1 = () => {};
const fn2 = () => {};
// Without dependencies argument
React.useEffect(fn1);
assert.strictEqual(receivedCalls.length, 1);
assert.strictEqual(receivedCalls[0].create, fn1);
assert.strictEqual(receivedCalls[0].deps, undefined);
// With empty dependencies array
React.useEffect(fn2, []);
assert.strictEqual(receivedCalls.length, 2);
assert.strictEqual(receivedCalls[1].create, fn2);
assert.deepStrictEqual(receivedCalls[1].deps, []);
} finally {
internals.H = null;
}
}
// Contract 6: react react-server entry explicitly omits useEffect export in server component environments
{
const pkgJsonPath = require.resolve('react/package.json');
const pkgDir = path.dirname(pkgJsonPath);
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
const reactServerEntry = path.join(pkgDir, pkgJson.exports['.']['react-server']);
const reactServer = require(reactServerEntry);
assert.strictEqual(reactServer.version, '19.2.8');
assert.strictEqual(reactServer.useEffect, undefined);
}
console.log('All react.useEffect contract tests passed.');
オリジンシーダー
匿名