{"id":18226902,"url":"https://github.com/sliptype/cycle-react-pragma","last_synced_at":"2025-04-03T09:30:27.835Z","repository":{"id":34870640,"uuid":"183129600","full_name":"sliptype/cycle-react-pragma","owner":"sliptype","description":"A jsx pragma for @cycle/react","archived":false,"fork":false,"pushed_at":"2022-12-03T09:09:12.000Z","size":976,"stargazers_count":3,"open_issues_count":12,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-16T08:30:57.842Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sliptype.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-24T02:15:00.000Z","updated_at":"2020-03-08T07:44:30.000Z","dependencies_parsed_at":"2023-01-15T10:00:44.238Z","dependency_job_id":null,"html_url":"https://github.com/sliptype/cycle-react-pragma","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sliptype%2Fcycle-react-pragma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sliptype%2Fcycle-react-pragma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sliptype%2Fcycle-react-pragma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sliptype%2Fcycle-react-pragma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sliptype","download_url":"https://codeload.github.com/sliptype/cycle-react-pragma/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246975979,"owners_count":20862997,"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":[],"created_at":"2024-11-04T05:03:59.476Z","updated_at":"2025-04-03T09:30:27.503Z","avatar_url":"https://github.com/sliptype.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ⚠ This is now part of [cyclejs/react-dom](https://github.com/cyclejs/react-dom)!\n\n# cycle-react-pragma\nA jsx pragma for @cycle/react\n\n## Motivation\n\nAlthough JSX only has secondary support in [Cycle.js](https://github.com/cyclejs), it is highly familiar to users of [React](https://github.com/facebook/react).\n\nRecently, it was made possible to [render React components in Cycle and vice versa](https://staltz.com/use-react-in-cyclejs-and-vice-versa.html).\n\nThis pragma allows you to use React-style JSX when rendering React components in Cycle.js\n\n## Installation\n\n```bash\nyarn add cycle-react-pragma\n```\n\n### Babel\n\nAdd the following to your webpack config:\n\n```js\nmodule: {\n  rules: [\n    {\n      test: /\\.jsx?$/,\n      loader: 'babel-loader',\n      options: {\n        plugins: [\n          ['transform-react-jsx', { pragma: 'CycleReactPragma.createElement' }],\n        ]\n      }\n    }\n  ]\n},\n```\n\nIf you used `create-cycle-app` you may have to eject to modify the config.\n\n### Automatically providing CycleReactPragma\n\nYou can avoid having to import `cycle-react-pragma` in every jsx file by allowing webpack to provide it:\n\n```js\nplugins: [\n  new webpack.ProvidePlugin({\n    CycleReactPragma: ['cycle-react-pragma', 'default']\n  })\n],\n```\n\n### Typescript\n\nAdd the following to your `tsconfig.json`:\n\n```js\n{\n  \"compilerOptions\": {\n    \"jsx\": \"react\",\n    \"jsxFactory\": \"CycleReactPragma.createElement\"\n  }\n}\n```\n\nIf webpack is providing `CycleReactPragma` you will need to add typings to `custom-typings.d.ts`:\n\n```js\ndeclare var CycleReactPragma: any;\n```\n\n\n## Usage\n\n```js\nfunction view(state$: Stream\u003cState\u003e): Stream\u003cReactElement\u003e {\n    return state$.map(({ count }) =\u003e (\n        \u003cdiv\u003e\n            \u003ch2\u003eCounter: {count}\u003c/h2\u003e\n            \u003cbutton sel=\"add\"\u003eAdd\u003c/button\u003e\n            \u003cbutton sel=\"subtract\"\u003eSubtract\u003c/button\u003e\n        \u003c/div\u003e\n    ));\n}\n```\n\n## Notes\n\nPlease ensure you are depending on compatible versions of `@cycle/react` and `@cycle/react-dom`. They should both be at least version `2.1.x`.\n\n```\nyarn list @cycle/react\n```\n\nshould return a single result.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsliptype%2Fcycle-react-pragma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsliptype%2Fcycle-react-pragma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsliptype%2Fcycle-react-pragma/lists"}