{"id":28690764,"url":"https://github.com/ahnafyy/string-2-react","last_synced_at":"2026-04-20T06:02:51.373Z","repository":{"id":147015283,"uuid":"618515024","full_name":"ahnafyy/string-2-react","owner":"ahnafyy","description":"Turn your valid HTML strings into React components with ease!","archived":false,"fork":false,"pushed_at":"2023-08-21T17:17:55.000Z","size":642,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T20:18:34.186Z","etag":null,"topics":["html","javascript","parser","react"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ahnafyy.png","metadata":{"files":{"readme":"Readme.MD","changelog":null,"contributing":null,"funding":null,"license":"License.MD","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,"zenodo":null}},"created_at":"2023-03-24T16:26:30.000Z","updated_at":"2023-03-24T16:45:35.000Z","dependencies_parsed_at":"2025-06-14T06:07:36.916Z","dependency_job_id":"ddc784fe-047f-4b65-9f9c-b04b4a8b8ba6","html_url":"https://github.com/ahnafyy/string-2-react","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ahnafyy/string-2-react","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahnafyy%2Fstring-2-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahnafyy%2Fstring-2-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahnafyy%2Fstring-2-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahnafyy%2Fstring-2-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahnafyy","download_url":"https://codeload.github.com/ahnafyy/string-2-react/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahnafyy%2Fstring-2-react/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32035276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["html","javascript","parser","react"],"created_at":"2025-06-14T06:07:33.316Z","updated_at":"2026-04-20T06:02:51.180Z","avatar_url":"https://github.com/ahnafyy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# string-2-react 🧵  ⚛️\n\nTurn your valid HTML strings into React components with ease! \n\n## Installation\n\nYou can install the package using `npm` or `yarn`:\n\n```bash\nnpm install string-2-react\n```\n\n```bash\nyarn add string-2-react \n```\n\n## Usage\n\n```javascript\n`const { stringToReactComponent } = require('string-2-react');\n\nconst htmlString = '\u003cdiv\u003e\u003ch1\u003eHello World\u003c/h1\u003e\u003cp\u003eWelcome to my awesome website!\u003c/p\u003e\u003c/div\u003e';\nconst reactComponent = stringToReactComponent(htmlString);\n\nconsole.log(reactComponent);\n// Output: \u003cdiv\u003e\u003ch1\u003eHello World\u003c/h1\u003e\u003cp\u003eWelcome to my awesome website!\u003c/p\u003e\u003c/div\u003e` \n```\n\n## API\n\n### `stringToReactComponent(html: string): string`\n\nTransforms the given HTML string into a React component string.\n\n#### Arguments\n\n-   `html` (string): The HTML string to convert.\n\n#### Returns\n\n-   The React component.\n\nThis is a package that converts your valid HTML strings into React components, making it easier to integrate them into your React applications.\n\n## Advantages\n\n- `string-2-react` is a lightweight package that can be easily integrated into your React project.\n\n- It efficiently converts your HTML strings into React components.\n\n- The package is easy to use, and you can get started with just a few lines of code.\n\n- It handles different types of HTML elements, including self-closing tags, start tags, and end tags, as well as `\u003cscript\u003e` tags.\n\n## Limitations\n\n- `string-2-react` is not meant to handle complex HTML strings that include other types of non-HTML content besides `\u003cscript\u003e` tags.\n\n- Does not sanitize the html \n\n- Does not do validation\n\n- Does not provide support against XSS\n\n## Conclusion\n\nIf you find any bugs or want to contribute to the project, feel free to open an issue or submit a pull request on GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahnafyy%2Fstring-2-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahnafyy%2Fstring-2-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahnafyy%2Fstring-2-react/lists"}