{"id":13807425,"url":"https://github.com/hobofan/reacty_yew","last_synced_at":"2025-04-13T06:05:24.438Z","repository":{"id":56285222,"uuid":"312057193","full_name":"hobofan/reacty_yew","owner":"hobofan","description":"Generate Yew components from React components via Typescript type definitions","archived":false,"fork":false,"pushed_at":"2020-11-16T20:39:23.000Z","size":1875,"stargazers_count":54,"open_issues_count":6,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-13T06:04:42.860Z","etag":null,"topics":["jsx","proc-macro","react","typescript","yew"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hobofan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-11T18:35:48.000Z","updated_at":"2024-07-22T20:56:39.000Z","dependencies_parsed_at":"2022-08-15T16:00:52.704Z","dependency_job_id":null,"html_url":"https://github.com/hobofan/reacty_yew","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobofan%2Freacty_yew","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobofan%2Freacty_yew/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobofan%2Freacty_yew/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hobofan%2Freacty_yew/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hobofan","download_url":"https://codeload.github.com/hobofan/reacty_yew/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670437,"owners_count":21142904,"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":["jsx","proc-macro","react","typescript","yew"],"created_at":"2024-08-04T01:01:25.337Z","updated_at":"2025-04-13T06:05:24.400Z","avatar_url":"https://github.com/hobofan.png","language":"JavaScript","funding_links":[],"categories":["Crates"],"sub_categories":["Utils"],"readme":"## reacty_yew - Generate Yew components from React component via Typescript type definitions\n\nThis is a proof of concept for automatically generating [Yew](https://yew.rs/) components from React components that have Typescript type definitions. Many parts are missing and this **likely shouldn't be used in production!**\n\n[Announcement blog post with a bit more information](https://www.hobofan.com/blog/2020-11-10-reacty_yew/)\n\n## Showcase\n\nFor the full example see [./examples/bad_button](./examples/bad_button).\n\nGiven a React component:\n\n```tsx\nimport * as React from \"react\";\n\ninterface BadButtonProps {\n  color?: string,\n  text: string,\n}\n\nconst BadButton = (props: BadButtonProps): JSX.Element =\u003e {\n  return (\n    \u003cbutton\n      style={{ backgroundColor: props.color }}\n      onClick={() =\u003e window.alert(\"Click!\")}\n    \u003e\n      {props.text}\n    \u003c/button\u003e\n  );\n\n};\n\nexport { BadButton };\n```\n\nAn invocation of the `react_component_mod!` macro (takes as input the name of the module to generate, path to the type declarations and the JS global (UMD) that holds the React components) generates a module:\n\n```rust\nreact_component_mod!(\n    bad_button;\n    types = \"../js_package/dist/index.d.ts\",\n    global = \"BadButtonLib\"\n);\n```\n\nYou can directly use the generated component `BadButton` in a Yew component:\n\n```rust\nuse yew::prelude::*;\nuse crate::bad_button::BadButton;\n\n// ...\nfn view(\u0026self) -\u003e Html {\n    html! {\n        \u003cdiv\u003e\n            \u003cBadButton text=\"Actual props\" /\u003e\n        \u003c/div\u003e\n    }\n}\n// ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhobofan%2Freacty_yew","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhobofan%2Freacty_yew","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhobofan%2Freacty_yew/lists"}