{"id":23719510,"url":"https://github.com/appfigures/jsx-html-class","last_synced_at":"2025-09-03T21:30:29.356Z","repository":{"id":35695917,"uuid":"39972983","full_name":"appfigures/jsx-html-class","owner":"appfigures","description":"Babel plugin to allow the use of \"class\" instead of \"className\" in JSX","archived":false,"fork":false,"pushed_at":"2015-07-30T22:29:29.000Z","size":144,"stargazers_count":24,"open_issues_count":2,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-03T09:14:04.072Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/appfigures.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":"2015-07-30T21:18:26.000Z","updated_at":"2020-09-24T22:38:34.000Z","dependencies_parsed_at":"2022-09-20T00:20:41.427Z","dependency_job_id":null,"html_url":"https://github.com/appfigures/jsx-html-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/appfigures%2Fjsx-html-class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appfigures%2Fjsx-html-class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appfigures%2Fjsx-html-class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appfigures%2Fjsx-html-class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appfigures","download_url":"https://codeload.github.com/appfigures/jsx-html-class/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231918552,"owners_count":18445746,"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-12-30T21:52:19.358Z","updated_at":"2024-12-30T21:52:19.937Z","avatar_url":"https://github.com/appfigures.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsx-html-class\n[Babel](https://babeljs.io/) plugin to allow the use of \"class\" instead of \"className\" in JSX\n\nhttps://www.npmjs.com/package/jsx-html-class\n\n## Motivation\n\nReact.js requires we use the attribute `className` instead of the traditional `class` in JSX elements.\n\n```javascript\nclass MyComponent extends React.Component {\n  render() {\n    return \u003cdiv className=\"container\"\u003eHello world\u003c/div\u003e;\n  }\n}\n```\n\nIf you are human, you've forgotten this at least once. If you're like me, you forget this all the time. Fortunately, React warns us...\n\n\u003e Warning: Unknown DOM property class. Did you mean className?\n\n\nHowever, considering we are already transpiling this code with [Babel](https://babeljs.io/), why not just convert `class` to `className` and never think about this again?\n\nThis is especially useful if you are lucky enough to have designers writing JSX or you often copy \u0026 paste HTML into your React components.\n\n## Installation\n\n```\nnpm install --save-dev jsx-html-class\n```\n\n#### CLI\n```\nbabel --plugins jsx-html-class script.js\n```\n\n#### .babelrc\n```\n{\n  \"plugins\": [\"jsx-html-class\"]\n}\n```\n\n#### Babelify\n```\nbrowserify({\n  // etc etc\n  transform: [\n    babelify.configure({\n      plugins: [\"jsx-html-class\"]\n    })\n  ]\n});\n```\n\nNow you can freely use either `class` or `className` and safely ensure your HTML classes will be properly rendered.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappfigures%2Fjsx-html-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappfigures%2Fjsx-html-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappfigures%2Fjsx-html-class/lists"}