{"_id":"react18-use","_rev":"6-60552419f7fe5cd11f9a2b7f22a3f8fa","name":"react18-use","dist-tags":{"latest":"0.4.1"},"versions":{"0.0.0":{"name":"react18-use","version":"0.0.0","_id":"react18-use@0.0.0","maintainers":[{"name":"daishi","email":"daishi@axlight.com"}],"dist":{"shasum":"d6d5df2b0fdbb2245bdd6d60ee19e0a51010db4a","tarball":"https://registry.npmjs.org/react18-use/-/react18-use-0.0.0.tgz","fileCount":1,"integrity":"sha512-K0mIOHILaJXFmnhLEI1nvFrfCsOz8xulZL6QIU2dSFFoXQ6f6flDhum9NA9vxgOfsigdXuEDuOgUds/4qgyN7g==","signatures":[{"sig":"MEUCIQDNCA0T+Ikt18xg0EzKktBNANFdWUsTdmAwmEhUIl/zkwIgQzfNPO3vu9YDYSZcmuMdCRvW4rcC8ulus4vIofeAm7s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":50},"_npmUser":{"name":"daishi","email":"daishi@axlight.com"},"_npmVersion":"9.6.7","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/react18-use_0.0.0_1723683270170_0.5883371344191337","host":"s3://npm-registry-packages"}},"0.1.0":{"name":"react18-use","version":"0.1.0","keywords":["react","use","hook"],"author":{"name":"Daishi Kato"},"license":"MIT","_id":"react18-use@0.1.0","maintainers":[{"name":"daishi","email":"daishi@axlight.com"}],"homepage":"https://github.com/dai-shi/react18-use#readme","bugs":{"url":"https://github.com/dai-shi/react18-use/issues"},"dist":{"shasum":"37481da184658868ff2def22c6d69d89004681e3","tarball":"https://registry.npmjs.org/react18-use/-/react18-use-0.1.0.tgz","fileCount":9,"integrity":"sha512-b3VJYPcIvgnMvydRbwzf6AzPzsjYC2jWY4fR1YAhZFiHy2230zFUN669gp8mcio+iJH0RZlGDL2I+UfUSV84Lg==","signatures":[{"sig":"MEUCIQC7KFO7njtrBop114z42YaWSEuCfZJO8jfV+Jd1+CQDIwIgffkNV9jEpFIkv8EzQtCssAGZn0r2FFvK4HoiCaoL4AU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8230},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","source":"./src/index.ts","exports":{".":{"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}},"./immer":{"default":{"types":"./dist/immer/index.d.ts","default":"./dist/immer/index.js"},"require":{"types":"./dist/cjs/immer/index.d.ts","default":"./dist/cjs/immer/index.js"}},"./package.json":"./package.json"},"gitHead":"ab2b8cceb51ebb0363f2945723629d29b86eda26","scripts":{"test":"pnpm run '/^test:.*/'","compile":"rm -rf dist && pnpm run '/^compile:.*/'","test:lint":"eslint .","test:spec":"vitest run","test:types":"tsc -p . --noEmit","compile:cjs":"tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json","compile:esm":"tsc -p tsconfig.esm.json","test:format":"prettier -c .","examples:01_counter":"DIR=01_counter vite","test:types:examples":"tsc -p examples --noEmit"},"_npmUser":{"name":"daishi","email":"daishi@axlight.com"},"prettier":{"singleQuote":true},"repository":{"url":"git+https://github.com/dai-shi/react18-use.git","type":"git"},"_npmVersion":"10.7.0","description":"React 19 use hook shim","directories":{},"sideEffects":false,"_nodeVersion":"18.20.4","_hasShrinkwrap":false,"packageManager":"pnpm@8.15.0","devDependencies":{"vite":"^5.4.0","react":"^18.3.1","eslint":"8.57.0","vitest":"2.0.5","prettier":"^3.3.3","happy-dom":"^14.12.3","react-dom":"^18.3.1","ts-expect":"^1.3.0","typescript":"^5.5.4","@types/node":"^22.3.0","react18-use":"link:.","@types/react":"^18.3.3","@types/react-dom":"^18.3.0","eslint-plugin-react":"^7.35.0","eslint-plugin-import":"^2.29.1","@testing-library/react":"^16.0.0","eslint-config-prettier":"^9.1.0","eslint-plugin-jsx-a11y":"^6.9.0","@testing-library/jest-dom":"6.4.8","@typescript-eslint/parser":"^8.1.0","eslint-plugin-react-hooks":"^4.6.2","@testing-library/user-event":"^14.5.2","@typescript-eslint/eslint-plugin":"^8.1.0","eslint-import-resolver-typescript":"^3.6.1"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react18-use_0.1.0_1723685602724_0.9881693917932668","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"react18-use","version":"0.2.0","keywords":["react","use","hook"],"author":{"name":"Daishi Kato"},"license":"MIT","_id":"react18-use@0.2.0","maintainers":[{"name":"daishi","email":"daishi@axlight.com"}],"homepage":"https://github.com/dai-shi/react18-use#readme","bugs":{"url":"https://github.com/dai-shi/react18-use/issues"},"dist":{"shasum":"4362a60271b9a28faab56763185ef75c84ec28c6","tarball":"https://registry.npmjs.org/react18-use/-/react18-use-0.2.0.tgz","fileCount":9,"integrity":"sha512-hFJl+napdUx0bqdA/hGODSjvpT07Hj7mRJfn7YbABLzoynrLoBCd6tiH3z29e/RC45XHLSyiXncld42ox/vXRA==","signatures":[{"sig":"MEUCIQDl2Q8GeGX5feeRz2buMm9qGjbTPWqodFlAC1Peetgy1gIgZbPieQZKnp59xfAHBBwa/eAf1nX+pxb91dem3rOna+4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8836},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","source":"./src/index.ts","exports":{".":{"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}},"./immer":{"default":{"types":"./dist/immer/index.d.ts","default":"./dist/immer/index.js"},"require":{"types":"./dist/cjs/immer/index.d.ts","default":"./dist/cjs/immer/index.js"}},"./package.json":"./package.json"},"gitHead":"d642ce46be08e2a71ba9d2d302a3369ca8d78b7b","scripts":{"test":"pnpm run '/^test:.*/'","compile":"rm -rf dist && pnpm run '/^compile:.*/'","test:lint":"eslint .","test:spec":"vitest run","test:types":"tsc -p . --noEmit","compile:cjs":"tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json","compile:esm":"tsc -p tsconfig.esm.json","test:format":"prettier -c .","examples:01_counter":"DIR=01_counter vite","test:types:examples":"tsc -p examples --noEmit"},"_npmUser":{"name":"daishi","email":"daishi@axlight.com"},"prettier":{"singleQuote":true},"repository":{"url":"git+https://github.com/dai-shi/react18-use.git","type":"git"},"_npmVersion":"10.7.0","description":"React 19 use hook shim","directories":{},"sideEffects":false,"_nodeVersion":"18.20.4","_hasShrinkwrap":false,"packageManager":"pnpm@8.15.0","devDependencies":{"vite":"^5.4.0","react":"^18.3.1","eslint":"8.57.0","vitest":"2.0.5","prettier":"^3.3.3","happy-dom":"^14.12.3","react-dom":"^18.3.1","ts-expect":"^1.3.0","typescript":"^5.5.4","@types/node":"^22.3.0","react18-use":"link:.","@types/react":"^18.3.3","@types/react-dom":"^18.3.0","eslint-plugin-react":"^7.35.0","eslint-plugin-import":"^2.29.1","@testing-library/react":"^16.0.0","eslint-config-prettier":"^9.1.0","eslint-plugin-jsx-a11y":"^6.9.0","@testing-library/jest-dom":"6.4.8","@typescript-eslint/parser":"^8.1.0","eslint-plugin-react-hooks":"^4.6.2","@testing-library/user-event":"^14.5.2","@typescript-eslint/eslint-plugin":"^8.1.0","eslint-import-resolver-typescript":"^3.6.1"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react18-use_0.2.0_1723811376480_0.6491485707458997","host":"s3://npm-registry-packages"}},"0.3.0":{"name":"react18-use","version":"0.3.0","keywords":["react","use","hook"],"author":{"name":"Daishi Kato"},"license":"MIT","_id":"react18-use@0.3.0","maintainers":[{"name":"daishi","email":"daishi@axlight.com"}],"homepage":"https://github.com/dai-shi/react18-use#readme","bugs":{"url":"https://github.com/dai-shi/react18-use/issues"},"dist":{"shasum":"7f18e251183393946696e7f16ae4b9b70023f28a","tarball":"https://registry.npmjs.org/react18-use/-/react18-use-0.3.0.tgz","fileCount":19,"integrity":"sha512-h/s6y9CRE/LV3QZvEtS4iBg5UThXTyHCjbfxzHEHEoRISaQa9SVQ7pdTnUt7M83URP1QRJ2bVSDwMpBIvmi50w==","signatures":[{"sig":"MEUCIQChni9/N8g14LPHGBt23wNoSNifsC0MdxuNKhjIGGXYDgIgJ1qFAWYsYZ5d/cRsSZH8UU/uRT7O/Zi5Hw371/MViM8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21970},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","source":"./src/index.ts","exports":{".":{"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}},"./immer":{"default":{"types":"./dist/immer/index.d.ts","default":"./dist/immer/index.js"},"require":{"types":"./dist/cjs/immer/index.d.ts","default":"./dist/cjs/immer/index.js"}},"./package.json":"./package.json"},"gitHead":"520a7dbbb73d8777d3c30d6e3dc710099f888e73","scripts":{"test":"pnpm run '/^test:.*/'","compile":"rm -rf dist && pnpm run '/^compile:.*/'","test:lint":"eslint .","test:spec":"vitest run","test:types":"tsc -p . --noEmit","compile:cjs":"tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json","compile:esm":"tsc -p tsconfig.esm.json","test:format":"prettier -c .","examples:01_counter":"DIR=01_counter vite","examples:02_context":"DIR=02_context vite","test:types:examples":"tsc -p examples --noEmit"},"_npmUser":{"name":"daishi","email":"daishi@axlight.com"},"prettier":{"singleQuote":true},"repository":{"url":"git+https://github.com/dai-shi/react18-use.git","type":"git"},"_npmVersion":"10.7.0","description":"React 19 use hook shim","directories":{},"sideEffects":false,"_nodeVersion":"18.20.4","_hasShrinkwrap":false,"packageManager":"pnpm@8.15.0","devDependencies":{"vite":"^5.4.0","react":"^18.3.1","eslint":"8.57.0","vitest":"2.0.5","prettier":"^3.3.3","happy-dom":"^14.12.3","react-dom":"^18.3.1","ts-expect":"^1.3.0","typescript":"^5.5.4","@types/node":"^22.3.0","react18-use":"link:.","@types/react":"^18.3.3","@types/react-dom":"^18.3.0","eslint-plugin-react":"^7.35.0","eslint-plugin-import":"^2.29.1","@testing-library/react":"^16.0.0","eslint-config-prettier":"^9.1.0","eslint-plugin-jsx-a11y":"^6.9.0","@testing-library/jest-dom":"6.4.8","@typescript-eslint/parser":"^8.1.0","eslint-plugin-react-hooks":"^4.6.2","@testing-library/user-event":"^14.5.2","@typescript-eslint/eslint-plugin":"^8.1.0","eslint-import-resolver-typescript":"^3.6.1"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react18-use_0.3.0_1724063882775_0.45153309908394657","host":"s3://npm-registry-packages"}},"0.4.0":{"name":"react18-use","version":"0.4.0","keywords":["react","use","hook"],"author":{"name":"Daishi Kato"},"license":"MIT","_id":"react18-use@0.4.0","maintainers":[{"name":"daishi","email":"daishi@axlight.com"}],"homepage":"https://github.com/dai-shi/react18-use#readme","bugs":{"url":"https://github.com/dai-shi/react18-use/issues"},"dist":{"shasum":"acb8ba5eeb7c38a79885ec3593a9da54e4bcfb3b","tarball":"https://registry.npmjs.org/react18-use/-/react18-use-0.4.0.tgz","fileCount":24,"integrity":"sha512-2YR1lYVrmRu6bE+geGlOIjrJrWoeURWV156t6hoMTyCcmfkcgRADyW3JVxiRCV/MjsqAEgGRjR6itqiCJib+2w==","signatures":[{"sig":"MEYCIQCkmrGNvU49LzduyUkCOh+5DFDfw6kUiapf0T2iXk7LSwIhALLhVVHIpOsZ6FeImV79iGwsEmEkElQaRGRkQobCY2qt","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28101},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","source":"./src/index.ts","exports":{".":{"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}},"./immer":{"default":{"types":"./dist/immer/index.d.ts","default":"./dist/immer/index.js"},"require":{"types":"./dist/cjs/immer/index.d.ts","default":"./dist/cjs/immer/index.js"}},"./package.json":"./package.json"},"gitHead":"f681b9b47c1235b2f00bc7055c0ffc53dba880ee","scripts":{"test":"pnpm run '/^test:.*/'","compile":"rm -rf dist && pnpm run '/^compile:.*/'","test:lint":"eslint .","test:spec":"vitest run","test:types":"tsc -p . --noEmit","compile:cjs":"tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json","compile:esm":"tsc -p tsconfig.esm.json","test:format":"prettier -c .","examples:01_counter":"DIR=01_counter vite","examples:02_context":"DIR=02_context vite","test:types:examples":"tsc -p examples --noEmit"},"_npmUser":{"name":"daishi","email":"daishi@axlight.com"},"prettier":{"singleQuote":true},"repository":{"url":"git+https://github.com/dai-shi/react18-use.git","type":"git"},"_npmVersion":"10.8.2","description":"React 19 use hook shim","directories":{},"sideEffects":false,"_nodeVersion":"18.20.5","_hasShrinkwrap":false,"packageManager":"pnpm@9.4.0","devDependencies":{"vite":"^6.0.11","react":"^18.3.1","eslint":"9.19.0","vitest":"3.0.4","prettier":"^3.4.2","happy-dom":"^16.7.2","react-dom":"^18.3.1","ts-expect":"^1.3.0","@eslint/js":"^9.19.0","typescript":"^5.7.3","@types/node":"^22.10.10","react18-use":"link:","@types/react":"^19.0.8","@types/react-dom":"^19.0.3","typescript-eslint":"^8.21.0","eslint-plugin-react":"^7.37.4","vite-tsconfig-paths":"^5.1.4","eslint-plugin-import":"^2.31.0","@testing-library/react":"^16.2.0","eslint-plugin-jsx-a11y":"^6.10.2","@testing-library/jest-dom":"6.6.3","eslint-plugin-react-hooks":"5.2.0-canary-de1eaa26-20250124","@testing-library/user-event":"^14.6.1","eslint-plugin-react-compiler":"19.0.0-beta-decd7b8-20250118","eslint-import-resolver-typescript":"^3.7.0"},"peerDependencies":{"react":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react18-use_0.4.0_1737948844747_0.708946884078355","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"react18-use","description":"React 19 use hook shim","version":"0.4.1","type":"module","author":{"name":"Daishi Kato"},"repository":{"type":"git","url":"git+https://github.com/dai-shi/react18-use.git"},"source":"./src/index.ts","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{"./package.json":"./package.json",".":{"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"},"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./immer":{"require":{"types":"./dist/cjs/immer/index.d.ts","default":"./dist/cjs/immer/index.js"},"default":{"types":"./dist/immer/index.d.ts","default":"./dist/immer/index.js"}}},"sideEffects":false,"packageManager":"pnpm@9.4.0","scripts":{"compile":"rm -rf dist && pnpm run '/^compile:.*/'","compile:esm":"tsc -p tsconfig.esm.json","compile:cjs":"tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json","test":"pnpm run '/^test:.*/'","test:format":"prettier -c .","test:lint":"eslint .","test:types":"tsc -p . --noEmit","test:types:examples":"tsc -p examples --noEmit","test:spec":"vitest run","examples:01_counter":"DIR=01_counter vite","examples:02_context":"DIR=02_context vite"},"keywords":["react","use","hook"],"license":"MIT","prettier":{"singleQuote":true},"devDependencies":{"@eslint/js":"^9.19.0","@testing-library/jest-dom":"6.6.3","@testing-library/react":"^16.2.0","@testing-library/user-event":"^14.6.1","@types/node":"^22.10.10","@types/react":"^19.0.8","@types/react-dom":"^19.0.3","eslint":"9.19.0","eslint-import-resolver-typescript":"^3.7.0","eslint-plugin-import":"^2.31.0","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-react":"^7.37.4","eslint-plugin-react-compiler":"19.0.0-beta-decd7b8-20250118","eslint-plugin-react-hooks":"5.2.0-canary-de1eaa26-20250124","happy-dom":"^16.7.2","prettier":"^3.4.2","react":"^18.3.1","react-dom":"^18.3.1","react18-use":"link:","ts-expect":"^1.3.0","typescript":"^5.7.3","typescript-eslint":"^8.21.0","vite":"^6.0.11","vite-tsconfig-paths":"^5.1.4","vitest":"3.0.4"},"peerDependencies":{"react":">=18.0.0"},"_id":"react18-use@0.4.1","gitHead":"9487c7e7db76ecfad56360364daf8dde68edfaa8","bugs":{"url":"https://github.com/dai-shi/react18-use/issues"},"homepage":"https://github.com/dai-shi/react18-use#readme","_nodeVersion":"22.15.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-NY59qMAOxmpjg3XJGfSotwmH9BVAD1kB4kZqjfB28yr6jQKaGh1F5i7X1N9OTn6dD5r8yqSH3X4SslcqxAxQCw==","shasum":"3f9a8bf1cee7e4e87995b7661c0d58e16ab85eef","tarball":"https://registry.npmjs.org/react18-use/-/react18-use-0.4.1.tgz","fileCount":24,"unpackedSize":28742,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC/8zrsAHLtg/HAMzYdO4a25bkLNmBvHw5Q77e909O0LQIgd6zhEf1YCFM8p+7SLre0B0GulKSu93Q7bPGjCl8h+r4="}]},"_npmUser":{"name":"daishi","email":"daishi@axlight.com"},"directories":{},"maintainers":[{"name":"daishi","email":"daishi@axlight.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react18-use_0.4.1_1747663132483_0.6359525489567381"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-15T00:54:30.169Z","modified":"2025-05-19T13:58:52.841Z","0.0.0":"2024-08-15T00:54:30.303Z","0.1.0":"2024-08-15T01:33:22.868Z","0.2.0":"2024-08-16T12:29:36.718Z","0.3.0":"2024-08-19T10:38:02.931Z","0.4.0":"2025-01-27T03:34:04.906Z","0.4.1":"2025-05-19T13:58:52.681Z"},"bugs":{"url":"https://github.com/dai-shi/react18-use/issues"},"author":{"name":"Daishi Kato"},"license":"MIT","homepage":"https://github.com/dai-shi/react18-use#readme","keywords":["react","use","hook"],"repository":{"type":"git","url":"git+https://github.com/dai-shi/react18-use.git"},"description":"React 19 use hook shim","maintainers":[{"name":"daishi","email":"daishi@axlight.com"}],"readme":"# react18-use\n\n[![CI](https://img.shields.io/github/actions/workflow/status/dai-shi/react18-use/ci.yml?branch=main)](https://github.com/dai-shi/react18-use/actions?query=workflow%3ACI)\n[![npm](https://img.shields.io/npm/v/react18-use)](https://www.npmjs.com/package/react18-use)\n[![size](https://img.shields.io/bundlephobia/minzip/react18-use)](https://bundlephobia.com/result?p=react18-use)\n[![discord](https://img.shields.io/discord/627656437971288081)](https://discord.gg/MrQdmzd)\n\nReact 19 use hook shim\n\n## Motivation\n\nWhile waiting for React 19, I still want to release a library that depends on React 19 use hook. Hense, this shim.\n\nIt also provides useMemo + use(Context) experimental feature, which we hope to have in React 19. (See: https://x.com/TkDodo/status/1741193371283026422 )\n\n## Install\n\n```bash\nnpm install react18-use\n```\n\n## Usage\n\n### Promise\n\nIt works both in React 18 and React 19. However, you don't need it if you are using React 19.\n\n```tsx\nimport { Suspense, useState } from 'react';\nimport { use } from 'react18-use';\n\nconst Counter = ({ countPromise }: { countPromise: Promise<number> }) => {\n  const count = use(countPromise);\n  return <p>Count: {count}</p>;\n};\n\nconst App = () => {\n  const [countPromise, setCountPromise] = useState(Promise.resolve(0));\n  return (\n    <div>\n      <button\n        onClick={() =>\n          setCountPromise(async (prev) => {\n            await new Promise((resolve) => setTimeout(resolve, 1000));\n            return (await prev) + 1;\n          })\n        }\n      >\n        +1\n      </button>\n      <Suspense fallback={<p>Loading...</p>}>\n        <Counter countPromise={countPromise} />\n      </Suspense>\n    </div>\n  );\n};\n```\n\n### Context\n\nIt works both in React 18 and React 19.\n\n```tsx\nimport { useState } from 'react';\nimport type { ReactNode } from 'react';\nimport { createContext, use, useMemo } from 'react18-use';\n\nconst MyContext = createContext({ foo: '', count: 0 });\n\nconst Component = () => {\n  const foo = useMemo(() => {\n    const { foo } = use(MyContext);\n    return foo;\n  }, []);\n  return (\n    <p>\n      Foo: {foo} ({Math.random()})\n    </p>\n  );\n};\n\nconst MyProvider = ({ children }: { children: ReactNode }) => {\n  const [count, setCount] = useState(1);\n  return (\n    <div>\n      <button onClick={() => setCount((c) => c + 1)}>{count}</button>\n      <MyContext.Provider value={{ foo: 'React', count }}>\n        {children}\n      </MyContext.Provider>\n    </div>\n  );\n};\n\nconst App = () => (\n  <MyProvider>\n    <Component />\n  </MyProvider>\n);\n```\n\n## Limitations\n\n- Only supports promises and contexts.\n- It might not work exactly the same as React 19.\n- useMemo with use(Context) is experimental (feedback welcome).\n\n## Examples\n\nThe [examples](examples) folder contains working examples.\nYou can run one of them with\n\n```bash\nPORT=8080 pnpm run examples:01_counter\n```\n\nand open <http://localhost:8080> in your web browser.\n\nYou can also try them directly:\n[01](https://stackblitz.com/github/dai-shi/react18-use/tree/main/examples/01_counter)\n[02](https://stackblitz.com/github/dai-shi/react18-use/tree/main/examples/02_context)\n\n## Tweets\n\n- https://x.com/dai_shi/status/1823896762542928373\n- https://x.com/dai_shi/status/1824424680721354980\n- https://x.com/dai_shi/status/1825484689030955094\n- https://x.com/dai_shi/status/1883730673091117386\n","readmeFilename":"README.md"}