{"id":21342860,"url":"https://github.com/hydux/hydux-react","last_synced_at":"2025-07-12T15:31:05.664Z","repository":{"id":57269885,"uuid":"113579447","full_name":"hydux/hydux-react","owner":"hydux","description":"Hydux + React =  :heart:","archived":false,"fork":false,"pushed_at":"2019-01-02T03:01:49.000Z","size":1138,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-21T14:59:23.936Z","etag":null,"topics":["elm","elmish","hydux","hyperapp","react","redux"],"latest_commit_sha":null,"homepage":null,"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/hydux.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}},"created_at":"2017-12-08T13:51:36.000Z","updated_at":"2023-12-26T09:46:26.000Z","dependencies_parsed_at":"2022-08-25T05:51:17.877Z","dependency_job_id":null,"html_url":"https://github.com/hydux/hydux-react","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/hydux/hydux-react","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hydux%2Fhydux-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hydux%2Fhydux-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hydux%2Fhydux-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hydux%2Fhydux-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hydux","download_url":"https://codeload.github.com/hydux/hydux-react/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hydux%2Fhydux-react/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261749322,"owners_count":23204004,"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":["elm","elmish","hydux","hyperapp","react","redux"],"created_at":"2024-11-22T01:10:52.625Z","updated_at":"2025-07-12T15:31:05.174Z","avatar_url":"https://github.com/hydux.png","language":"TypeScript","readme":"# hydux-react\nReact renderer for hydux.\n\n## Install\n```sh\nyarn add hydux hydux-react # or npm i hydux hydux-react\n```\n\n## Usage\n\n\n```js\nimport _app from 'hydux'\nimport withPersist from 'hydux/lib/enhancers/persist'\nimport withReact, { React } from 'hydux-react'\n\nlet app = withReact()(_app)\n\nexport default app({\n  init: () =\u003e { count: 1 },\n  actions: {\n    down: () =\u003e state =\u003e ({ count: state.count - 1 }),\n    up: () =\u003e state =\u003e ({ count: state.count + 1 })\n  },\n  view: (state: State, actions: Actions) =\u003e\n    \u003cdiv\u003e\n      \u003ch1\u003e{state.count}\u003c/h1\u003e\n      \u003cbutton onClick={actions.down}\u003e–\u003c/button\u003e\n      \u003cbutton onClick={actions.up}\u003e+\u003c/button\u003e\n    \u003c/div\u003e\n})\n```\n\n## Helpers\n\n### PureView\n\n[React.PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent) helper, with which the component uses a shallow prop comparison to determine whether to re-render, which in turn prevents unnecessary re-rendering.\n\n```tsx\n\nimport { PureView } from 'hydux-react'\n\nexport function View(props) {\n  return (\n    \u003cPureView stateInUse={props}\u003e // The props passed to PureView would be shallow compared and determine whether diff and render child components.\n      {(props) =\u003e \u003cChildComponent {...props} /\u003e} // here we pass function as children to avoid executing child components' render function.\n    \u003c/PureView\u003e\n  )\n}\n\n```\n\n## ErrorBoundary\n\nWe can use the ErrorBoundary component to catch children's error, which requires a [React 16 feature](https://reactjs.org/docs/error-boundaries.html).\n\n```tsx\nimport { ErrorBoundary } from 'hydux-react'\n\nexport function View(props) {\n  return (\n    \u003cErrorBoundary\n      report={(error, errorInfo) =\u003e void} // Custom error handler function\n      renderMessage={(error, errorInfo) =\u003e React.ChildNode} // Custom error message renderer, default is `return null`\n    \u003e\n      {() =\u003e \u003cChildComponent {...props} /\u003e} // here we pass function as children to catch errors in child components' render function.\n    \u003c/ErrorBoundary\u003e\n  )\n}\n```\n\n\n## Counter App\n\n```sh\ngit clone https://github.com/hydux/hydux-react.git\ncd examples/counter\nyarn # or npm i\nnpm start\n```\n\nNow open http://localhost:8080 and hack!\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhydux%2Fhydux-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhydux%2Fhydux-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhydux%2Fhydux-react/lists"}