{"library":"rehackt","title":"Rehackt: React Server Components Hook Hider","description":"Rehackt is an advanced utility library designed for JavaScript/TypeScript library developers working with Next.js and React Server Components (RSC). Its primary function is to invisibly wrap the `react` package, allowing shared imports that contain React hooks (e.g., `useState`, `useEffect`) to be used in server-side Next.js codebases without triggering static analysis errors from the Next.js build process. This prevents common build failures where RSC compilers erroneously flag client-side hooks in modules that are not intended for server-side execution but are imported into a server context. The package is currently at version `0.1.0` and appears to have an active, albeit niche, release cadence driven by changes in React's internal APIs related to RSC. Its key differentiator is solving a specific interop problem for libraries that need to expose both client and server functionalities and manage the RSC static analysis rules without extensive code splitting or dual packages. It does not enable actual hook execution on the server; it only circumvents build-time errors.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install rehackt"],"cli":null},"imports":["import { useState } from 'rehackt';","import { useEffect } from 'rehackt';","import { Fragment } from 'rehackt';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { useState } from \"rehackt\";\n\nexport const data = {\n  useForm: <T>(val: T) => {\n      useState(val)\n  },\n  name: \"server\"\n}\n\n// This shared module can now be imported into a server-side file (e.g., a Next.js server action)\n// without triggering a React Server Components error, even though it contains a client-side hook reference.\n// For example, in 'action.ts':\n// \"use server\"\n// import { data } from './shared-code';\n// export default async function someAction() {\n//   return 'Hello ' + data.name;\n// }","lang":"typescript","description":"Demonstrates replacing `import {useState} from \"react\"` with `import {useState} from \"rehackt\"` in a shared module to prevent React Server Components build errors when imported into a server-only context.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}