{"_id":"rehackt","_rev":"4321305","name":"rehackt","description":"A wrapper around React that will hide hooks from the React Server Component compiler","dist-tags":{"latest":"0.1.0","snapshot":"0.0.0-pr.10.0"},"maintainers":[{"name":"phryneas","email":""}],"time":{"modified":"2026-04-07T22:33:15.000Z","created":"2023-06-15T16:30:07.169Z","0.1.0":"2024-04-23T08:55:04.459Z","0.0.0-pr.10.0":"2024-04-22T09:49:45.832Z","0.0.6":"2024-02-23T21:58:11.381Z","0.0.5":"2024-02-14T12:22:27.321Z","0.0.4":"2023-12-13T19:24:16.734Z","0.0.3":"2023-08-28T14:24:57.048Z","0.0.2":"2023-06-16T14:21:10.446Z","0.0.1":"2023-06-15T16:30:07.169Z"},"users":{},"author":{"name":"Lenz Weber-Tronic"},"repository":{"type":"git","url":"git+https://github.com/phryneas/rehackt.git"},"versions":{"0.1.0":{"name":"rehackt","version":"0.1.0","description":"A wrapper around React that will hide hooks from the React Server Component compiler","author":{"name":"Lenz Weber-Tronic"},"repository":{"type":"git","url":"git+https://github.com/phryneas/rehackt.git"},"homepage":"https://github.com/phryneas/rehackt","license":"MIT","main":"index.js","exports":{".":{"types":"./index.d.ts","react-server":"./rsc.js","default":"./index.js"},"./package.json":"./package.json"},"peerDependencies":{"@types/react":"*","react":"*"},"peerDependenciesMeta":{"react":{"optional":true},"@types/react":{"optional":true}},"devDependencies":{"@types/node":"^20.5.7","react":"^19.0.0-canary-33a32441e9-20240418"},"prettier":{"printWidth":120},"_id":"rehackt@0.1.0","gitHead":"1150f7e2b8dae52ba5231bde1a42595839dd9603","types":"./index.d.ts","bugs":{"url":"https://github.com/phryneas/rehackt/issues"},"_nodeVersion":"18.20.2","_npmVersion":"10.5.0","dist":{"shasum":"a7c5e289c87345f70da8728a7eb878e5d03c696b","size":3712,"noattachment":false,"key":"/rehackt/-/rehackt-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/rehackt/download/rehackt-0.1.0.tgz"},"_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"directories":{},"maintainers":[{"name":"phryneas","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehackt_0.1.0_1713862504317_0.9343255824208265"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-04-23T08:55:04.459Z","publish_time":1713862504459,"_source_registry_name":"default","_cnpm_publish_time":1713862504459},"0.0.0-pr.10.0":{"name":"rehackt","version":"0.0.0-pr.10.0","description":"A wrapper around React that will hide hooks from the React Server Component compiler","author":{"name":"Lenz Weber-Tronic"},"repository":{"type":"git","url":"git+https://github.com/phryneas/rehackt.git"},"homepage":"https://github.com/phryneas/rehackt","license":"MIT","main":"index.js","exports":{".":{"types":"./index.d.ts","react-server":"./rsc.js","default":"./index.js"},"./package.json":"./package.json"},"peerDependencies":{"@types/react":"*","react":"*"},"peerDependenciesMeta":{"react":{"optional":true},"@types/react":{"optional":true}},"devDependencies":{"@types/node":"^20.5.7","react":"^19.0.0-canary-33a32441e9-20240418"},"prettier":{"printWidth":120},"_id":"rehackt@0.0.0-pr.10.0","readmeFilename":"README.md","gitHead":"a83bf86c89a375b9c5d354c4f6a14055526fba82","types":"./index.d.ts","bugs":{"url":"https://github.com/phryneas/rehackt/issues"},"_nodeVersion":"18.20.2","_npmVersion":"10.5.0","dist":{"shasum":"715861bf228a7306243ee900a077182ebb463bd8","size":3720,"noattachment":false,"key":"/rehackt/-/rehackt-0.0.0-pr.10.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/rehackt/download/rehackt-0.0.0-pr.10.0.tgz"},"_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"directories":{},"maintainers":[{"name":"phryneas","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehackt_0.0.0-pr.10.0_1713779385680_0.9706141598619316"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-04-22T09:49:45.832Z","publish_time":1713779385832,"_source_registry_name":"default","_cnpm_publish_time":1713779385832},"0.0.6":{"name":"rehackt","version":"0.0.6","description":"A wrapper around React that will hide hooks from the React Server Component compiler","author":{"name":"Lenz Weber-Tronic"},"repository":{"type":"git","url":"git+https://github.com/phryneas/rehackt.git"},"homepage":"https://github.com/phryneas/rehackt","license":"MIT","main":"index.js","exports":{".":{"types":"./index.d.ts","react-server":"./rsc.js","default":"./index.js"},"./package.json":"./package.json"},"peerDependencies":{"react":"*","@types/react":"*"},"peerDependenciesMeta":{"react":{"optional":true},"@types/react":{"optional":true}},"devDependencies":{"react":"^18.3.0-canary-ab31a9ed2-20230824","@types/node":"^20.5.7"},"prettier":{"printWidth":120},"_id":"rehackt@0.0.6","gitHead":"a42c837d82a376860707fff576e1499ca9fc60ec","types":"./index.d.ts","bugs":{"url":"https://github.com/phryneas/rehackt/issues"},"_nodeVersion":"18.19.1","_npmVersion":"10.2.4","dist":{"shasum":"7a0a2247f2295e7548915417e44fbbf03bf004f4","size":3392,"noattachment":false,"key":"/rehackt/-/rehackt-0.0.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/rehackt/download/rehackt-0.0.6.tgz"},"_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"directories":{},"maintainers":[{"name":"phryneas","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehackt_0.0.6_1708725491215_0.15199144264101272"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-02-23T21:58:11.381Z","publish_time":1708725491381,"_source_registry_name":"default","_cnpm_publish_time":1708725491381},"0.0.5":{"name":"rehackt","version":"0.0.5","description":"A wrapper around React that will hide hooks from the React Server Component compiler","author":{"name":"Lenz Weber-Tronic"},"repository":{"type":"git","url":"git+https://github.com/phryneas/rehackt.git"},"homepage":"https://github.com/phryneas/rehackt","license":"MIT","main":"index.js","exports":{".":{"types":"./index.d.ts","react-server":"./rsc.js","default":"./index.js"},"./package.json":"./package.json"},"peerDependencies":{"react":"*","@types/react":"*"},"peerDependenciesMeta":{"react":{"optional":true},"@types/react":{"optional":true}},"devDependencies":{"react":"^18.3.0-canary-ab31a9ed2-20230824","@types/node":"^20.5.7"},"prettier":{"printWidth":120},"_id":"rehackt@0.0.5","gitHead":"0e6704c5d57402e2e2f54544dbf1901d642cf083","types":"./index.d.ts","bugs":{"url":"https://github.com/phryneas/rehackt/issues"},"_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"shasum":"184c82ea369d5b0b989ede0593ebea8b2bcfb1d6","size":2709,"noattachment":false,"key":"/rehackt/-/rehackt-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/rehackt/download/rehackt-0.0.5.tgz"},"_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"directories":{},"maintainers":[{"name":"phryneas","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehackt_0.0.5_1707913347020_0.23126264376486927"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-02-14T12:22:27.321Z","publish_time":1707913347321,"_source_registry_name":"default","_cnpm_publish_time":1707913347321},"0.0.4":{"name":"rehackt","version":"0.0.4","description":"A wrapper around React that will hide hooks from the React Server Component compiler","author":{"name":"Lenz Weber-Tronic"},"repository":{"type":"git","url":"git+https://github.com/phryneas/rehackt.git"},"homepage":"https://github.com/phryneas/rehackt","license":"MIT","main":"index.js","exports":{".":{"types":"./index.d.ts","react-server":"./rsc.js","default":"./index.js"},"./package.json":"./package.json"},"peerDependencies":{"react":"*","@types/react":"*"},"peerDependenciesMeta":{"react":{"optional":true},"@types/react":{"optional":true}},"devDependencies":{"react":"^18.3.0-canary-ab31a9ed2-20230824","@types/node":"^20.5.7"},"_id":"rehackt@0.0.4","gitHead":"767e8f02748d26a6b1e3fa6122b8feb7fb21516c","types":"./index.d.ts","bugs":{"url":"https://github.com/phryneas/rehackt/issues"},"_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"shasum":"dca5498e1f6c81d3d610ff2abfb3c3feec6afce8","size":2486,"noattachment":false,"key":"/rehackt/-/rehackt-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/rehackt/download/rehackt-0.0.4.tgz"},"_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"directories":{},"maintainers":[{"name":"phryneas","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehackt_0.0.4_1702495456561_0.3469341180763572"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-12-13T19:24:16.734Z","publish_time":1702495456734,"_source_registry_name":"default","_cnpm_publish_time":1702495456734},"0.0.3":{"name":"rehackt","version":"0.0.3","description":"A wrapper around React that will hide hooks from the React Server Component compiler","author":{"name":"Lenz Weber-Tronic"},"repository":{"type":"git","url":"git+https://github.com/phryneas/rehackt.git"},"homepage":"https://github.com/phryneas/rehackt","license":"MIT","main":"index.js","exports":{".":{"types":"./index.d.ts","react-server":"./rsc.js","default":"./index.js"},"./package.json":"./package.json"},"peerDependencies":{"react":"*","@types/react":"*"},"peerDependenciesMeta":{"react":{"optional":true},"@types/react":{"optional":true}},"devDependencies":{"react":"^18.3.0-canary-ab31a9ed2-20230824","@types/node":"^20.5.7"},"types":"./index.d.ts","gitHead":"324240c1a643325b9bbf9d814a07d83babaee3aa","bugs":{"url":"https://github.com/phryneas/rehackt/issues"},"_id":"rehackt@0.0.3","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"shasum":"1ea454620d4641db8342e2db44595cf0e7ac6aa0","size":1273,"noattachment":false,"key":"/rehackt/-/rehackt-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/rehackt/download/rehackt-0.0.3.tgz"},"_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"directories":{},"maintainers":[{"name":"phryneas","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehackt_0.0.3_1693232696836_0.0242037668671935"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-28T14:24:57.048Z","publish_time":1693232697048,"_source_registry_name":"default","_cnpm_publish_time":1693232697048},"0.0.2":{"name":"rehackt","version":"0.0.2","description":"A wrapper around React that will hide hooks from the React Server Component compiler","author":{"name":"Lenz Weber-Tronic"},"repository":{"type":"git","url":"git+https://github.com/phryneas/rehackt.git"},"homepage":"https://github.com/phryneas/rehackt","license":"MIT","peerDependencies":{"react":"*"},"main":"index.js","exports":{".":{"react-server":"./rsc.js","default":"./index.js"},"./package.json":"./package.json"},"gitHead":"a1e4b6de79a7a711c6cfe2e5a088b0ab64da38d2","bugs":{"url":"https://github.com/phryneas/rehackt/issues"},"_id":"rehackt@0.0.2","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"shasum":"30dc08f07113dc6afa6dbc1e098e481a3143d052","size":930,"noattachment":false,"key":"/rehackt/-/rehackt-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/rehackt/download/rehackt-0.0.2.tgz"},"_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"directories":{},"maintainers":[{"name":"phryneas","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehackt_0.0.2_1686925270264_0.8474588393009195"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-06-16T14:21:10.446Z","publish_time":1686925270446,"_source_registry_name":"default","_cnpm_publish_time":1686925270446},"0.0.1":{"name":"rehackt","version":"0.0.1","description":"A wrapper around React that will hide hooks from the React Server Component compiler","author":{"name":"Lenz Weber-Tronic"},"license":"MIT","peerDependencies":{"react":"*"},"main":"index.js","exports":{".":{"react-server":"./rsc.js","default":"./index.js"},"./package.json":"./package.json"},"gitHead":"71993ab50cfb5872a8caf13d6a7644f6b809fd0c","_id":"rehackt@0.0.1","_nodeVersion":"19.6.1","_npmVersion":"9.4.0","dist":{"shasum":"41bca74319a27e9d57395ffb1eaa3406b22276cf","size":863,"noattachment":false,"key":"/rehackt/-/rehackt-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/rehackt/download/rehackt-0.0.1.tgz"},"_npmUser":{"name":"phryneas","email":"mail@lenzw.de"},"directories":{},"maintainers":[{"name":"phryneas","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehackt_0.0.1_1686846606951_0.15887337426422565"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-06-15T16:30:07.169Z","publish_time":1686846607169,"_source_registry_name":"default","_cnpm_publish_time":1686846607169}},"readme":"# Rehackt\r\n\r\n> This package is fairly advanced and is only intended for library developers that want to maintain high interop with Next.js server actions.\r\n\r\nRehackt invisibly wraps `react` so that you're able to use shared imports with `react` in server-side Next.js code without throwing an error to your users.\r\n\r\n## Explainer\r\n\r\nAssume you have the following code in a Next.js codebase:\r\n\r\n```tsx\r\n\"use client\"\r\n\r\nimport { useFormState } from \"react-dom\"\r\nimport someAction from \"./action\";\r\n\r\nexport const ClientComp = () => {\r\n  const [data, action] = useFormState(someAction, \"Hello client\");\r\n\r\n  return <form action={action}>\r\n    <p>{data}</p>\r\n    <button type={\"submit\"}>Update data</button>\r\n  </form>\r\n}\r\n```\r\n\r\n```tsx\r\n\"use server\"\r\n// action.ts\r\n\r\nimport {data} from \"./shared-code\";\r\n\r\nexport default async function someAction() {\r\n  return \"Hello \" + data.name;\r\n}\r\n```\r\n\r\n```tsx\r\n// shared-code.ts\r\nimport {useState} from \"react\";\r\n\r\nexport const data = {\r\n  useForm: <T>(val: T) => {\r\n      useState(val)\r\n  },\r\n  name: \"server\"\r\n}\r\n```\r\n\r\nWhile you're not intending to use `data.useForm` in your `action.ts` server-only file, you'll still receive the following error from Next.js' build process when trying to use this code:\r\n\r\n```shell\r\n./src/app/shared-code.ts\r\nReactServerComponentsError:\r\n\r\nYou're importing a component that needs useState. It only works in a Client Component but none of its parents are marked with \"use client\", so they're Server Components by default.\r\nLearn more: https://nextjs.org/docs/getting-started/react-essentials\r\n\r\n   ╭─[/src/app/shared-code.ts:1:1]\r\n 1 │ import {useState} from \"react\";\r\n   ·         ────────\r\n 2 │ \r\n 3 │ export const data = {\r\n 3 │   useForm: <T>(val: T) => {\r\n   ╰────\r\n\r\nMaybe one of these should be marked as a client entry with \"use client\":\r\n./src/app/shared-code.ts\r\n./src/app/action.ts\r\n```\r\n\r\nThis is because Next.js statically analyzes usage of `useState` to ensure it's not being utilized in server-only code.\r\n\r\nBy replacing the import from `react` to `rehackt`:\r\n\r\n```tsx\r\n// shared-code.ts\r\nimport {useState} from \"rehackt\";\r\n\r\nexport const data = {\r\n  useForm: <T>(val: T) => {\r\n      useState(val)\r\n  },\r\n  name: \"server\"\r\n}\r\n```\r\n\r\nYou'll no longer see this error.\r\n\r\n> Keep in mind, this does not enable usage of `useState` in server-only code, this just removes the error described above.\r\n\r\n## Further Reading\r\n\r\nThe following is a list of reading resources that pertain to this package:\r\n\r\n- [My take on the current React & Server Components controversy - Lenz Weber-Tronic](https://phryneas.de/react-server-components-controversy)\r\n\r\n- [apollographql/apollo-client#10974](https://github.com/apollographql/apollo-client/issues/10974)\r\n\r\n- [TanStack/form#480](https://github.com/TanStack/form/issues/480#issuecomment-1793576645)\r\n","_attachments":{},"homepage":"https://github.com/phryneas/rehackt","bugs":{"url":"https://github.com/phryneas/rehackt/issues"},"license":"MIT"}