{"id":13533358,"url":"https://github.com/orzarchi/react-codemod-pure-component-to-class","last_synced_at":"2025-04-01T21:32:15.245Z","repository":{"id":89493695,"uuid":"130397940","full_name":"orzarchi/react-codemod-pure-component-to-class","owner":"orzarchi","description":"A react codemod to transform stateless/pure/functional components to class components.","archived":false,"fork":false,"pushed_at":"2018-04-21T10:39:48.000Z","size":10,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-02T20:33:07.419Z","etag":null,"topics":[],"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/orzarchi.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}},"created_at":"2018-04-20T18:10:59.000Z","updated_at":"2019-02-07T07:55:58.000Z","dependencies_parsed_at":"2024-01-14T01:08:21.718Z","dependency_job_id":"5b5e7d06-7bb6-48f0-80e2-aa53b2852847","html_url":"https://github.com/orzarchi/react-codemod-pure-component-to-class","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/orzarchi%2Freact-codemod-pure-component-to-class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orzarchi%2Freact-codemod-pure-component-to-class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orzarchi%2Freact-codemod-pure-component-to-class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orzarchi%2Freact-codemod-pure-component-to-class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orzarchi","download_url":"https://codeload.github.com/orzarchi/react-codemod-pure-component-to-class/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246713357,"owners_count":20821876,"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-08-01T07:01:19.005Z","updated_at":"2025-04-01T21:32:14.969Z","avatar_url":"https://github.com/orzarchi.png","language":"JavaScript","funding_links":[],"categories":["Frameworks"],"sub_categories":["React.js"],"readme":"# Pure Component To class\n[![npm version](https://badge.fury.io/js/pure-component-to-class.svg)](https://badge.fury.io/js/pure-component-to-class)\n\n\nA react [codemod](https://github.com/reactjs/react-codemod/) to transform stateless/pure/functional components to class components.\n\nBased on:\n* [react-pure-to-class](https://github.com/angryobject/react-pure-to-class)\n* [js-transforms](https://github.com/jhgg/js-transforms/blob/master/pure-to-composite-component.js)\n\n### Usage:\n```\nnpm install pure-component-to-class\nnpm install -g jscodeshift\n\n// Run using IDE command or via CLI\njscodeshift -t node_modules/pure-component-to-class/pure-component-to-class.js components/TestComponent.jsx\n```\n\n### Examples:\n\n##### Before:\n```javascript\nexport default ({foo, bar}) =\u003e (\n  \u003cdiv\u003e{foo}\u003c/div\u003e\n)\n\nlet Foo = () =\u003e \u003cdiv\u003efoo\u003c/div\u003e;\n\nlet FooFunc = function (){\n  return \u003cdiv\u003efoo\u003c/div\u003e;\n};\n\nlet FooUsingProps = (props) =\u003e {\n  const {\n    item\n  } = props;\n\n  return \u003cli\u003e{item}{props.item2}\u003c/li\u003e;\n};\n\nlet FooUsingPropsWithDifferentName = (propsName) =\u003e {\n  const {\n    item\n  } = propsName;\n\n  return \u003cli\u003e{item}{propsName.item2}\u003c/li\u003e;\n};\n```\n##### After:\n```javascript\nexport default class extends React.Component {\n  render() {\n    const {foo, bar} = this.props;\n    return \u003cdiv\u003e{foo}\u003c/div\u003e;\n  }\n}\n\nclass Foo extends React.Component {\n  render() {\n    return \u003cdiv\u003efoo\u003c/div\u003e;\n  }\n}\n\nclass FooFunc extends React.Component {\n  render() {\n    return \u003cdiv\u003efoo\u003c/div\u003e;\n  }\n}\n\nclass FooUsingProps extends React.Component {\n  render() {\n    const {\n      item\n    } = this.props;\n\n    return \u003cli\u003e{item}{this.props.item2}\u003c/li\u003e;\n  }\n}\n\nclass FooUsingPropsWithDifferentName extends React.Component {\n  render() {\n    const propsName = this.props;\n    const {\n      item\n    } = propsName;\n\n    return \u003cli\u003e{item}{propsName.item2}\u003c/li\u003e;\n  }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forzarchi%2Freact-codemod-pure-component-to-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forzarchi%2Freact-codemod-pure-component-to-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forzarchi%2Freact-codemod-pure-component-to-class/lists"}