{"id":18931033,"url":"https://github.com/nanxiaobei/solid-react","last_synced_at":"2025-04-15T03:54:32.630Z","repository":{"id":42048370,"uuid":"472406370","full_name":"nanxiaobei/solid-react","owner":"nanxiaobei","description":"🧿 ˏˋSignalsˎˊ for React","archived":false,"fork":false,"pushed_at":"2023-09-12T16:26:47.000Z","size":175,"stargazers_count":108,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T03:54:17.601Z","etag":null,"topics":["effect","hooks","memo","qwik","react","signals","solidjs","state"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nanxiaobei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-21T15:48:58.000Z","updated_at":"2025-04-05T03:54:30.000Z","dependencies_parsed_at":"2024-11-08T11:43:43.373Z","dependency_job_id":"e2962369-b72e-45b0-b90e-b8206ea3e734","html_url":"https://github.com/nanxiaobei/solid-react","commit_stats":{"total_commits":47,"total_committers":1,"mean_commits":47.0,"dds":0.0,"last_synced_commit":"5b430e312d778373be63835b14e8ec7dc5d11f95"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanxiaobei%2Fsolid-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanxiaobei%2Fsolid-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanxiaobei%2Fsolid-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanxiaobei%2Fsolid-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nanxiaobei","download_url":"https://codeload.github.com/nanxiaobei/solid-react/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249003954,"owners_count":21196794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["effect","hooks","memo","qwik","react","signals","solidjs","state"],"created_at":"2024-11-08T11:40:15.271Z","updated_at":"2025-04-15T03:54:32.610Z","avatar_url":"https://github.com/nanxiaobei.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n\u003cp\u003e\u003ca href=\"https://kee.so/\" target=\"_blank\"\u003e\u003cimg src=\"https://i.imgur.com/x5SRUoo.png\" alt=\"kee.so\" /\u003e\u003c/a\u003e\u003c/p\u003e\n\nCreate now ➫ [🔗 kee.so](https://kee.so/)\n\n\u003c/div\u003e\n\n---\n\n# 🧿 solid-react\n\nHooks for a SolidJS-like React\n\n[![npm](https://img.shields.io/npm/v/solid-react?style=flat-square)](https://www.npmjs.com/package/solid-react)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/solid-react?style=flat-square)](https://bundlephobia.com/result?p=solid-react)\n[![npm type definitions](https://img.shields.io/npm/types/typescript?style=flat-square)](https://github.com/nanxiaobei/solid-react/blob/main/src/index.ts)\n[![GitHub](https://img.shields.io/github/license/nanxiaobei/solid-react?style=flat-square)](https://github.com/nanxiaobei/solid-react/blob/main/LICENSE)\n\n## Introduction\n\nTurn React into SolidJS, update on demand, no more re-render.\n\n☞ https://nanxiaobei.medium.com/turn-react-into-solidjs-update-on-demand-no-more-re-render-3230fe2f878c\n\n## Demo\n\nHere is a demo, you can open the console, click the button to try, and you will find:\n\nComponents don’t re-render anymore, React is completely SolidJS-style on-demand updates!\n\n`useUpdate` `useAuto` don't need anything like `deps`, their dependencies are automatically knew. And only when dependencies change, they execute again.\n\nYes, that is to say, you can get rid of Hooks, `useCallback` `useMemo` `deps` `memo`, they're unnecessary anymore.\n\n[![Edit solid-react](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/solid-react-rymhr6?fontsize=14\u0026hidenavigation=1\u0026theme=dark)\n\n## Install\n\n```bash\npnpm add solid-react\n# or\nyarn add solid-react\n# or\nnpm i solid-react\n```\n\n## API\n\n### `useSignal`\n\n```js\nimport { useSignal } from 'solid-react';\n\nconst [count, setCount] = useSignal(0);\n\nconst countDisplay = \u003cdiv\u003e{count()}\u003c/div\u003e;\n```\n\nReturns a getter and a setter. (like `createSignal`)\n\n### `useUpdate`\n\n```js\nimport { useUpdate } from 'solid-react';\n\nconst [count, setCount] = useSignal(0);\n\nuseUpdate(() =\u003e console.log('count:', count()));\n```\n\nThe callback runs at mount and when its dependencies change. (like `createEffect`)\n\n### `useAuto`\n\n```js\nimport { useAuto } from 'solid-react';\n\nconst value = useAuto(() =\u003e computeExpensiveValue(a(), b()));\n\nvalue();\n```\n\nReturns a computed value getter, re-compute when dependencies change. (like `createMemo`)\n\n### `useMount`\n\n```js\nimport { useMount } from 'solid-react';\n\nuseMount(() =\u003e console.log('mounted'));\n```\n\nRegister a method that runs after initial render. (like `onMount`)\n\n### `useCleanup`\n\n```js\nimport { useCleanup } from 'solid-react';\n\nel.addEventListener(event, callback);\n\nuseCleanup(() =\u003e el.removeEventListener(event, callback));\n```\n\nRegister a cleanup method that runs when unmount. (like `onCleanup`)\n\n### `Run`\n\n```js\nimport { Run } from 'solid-react';\n\n\u003cdiv\u003e{Run(() =\u003e (a() ? b() : c()))}\u003c/div\u003e;\n\u003cdiv\u003e{Run(() =\u003e Object.keys(obj())).map((e) =\u003e e)}\u003c/div\u003e;\n```\n\nA helper function for conditional operator or executions in jsx.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanxiaobei%2Fsolid-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnanxiaobei%2Fsolid-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanxiaobei%2Fsolid-react/lists"}