{"id":24458528,"url":"https://github.com/bike-js/react-bem","last_synced_at":"2025-03-14T08:43:35.035Z","repository":{"id":42821248,"uuid":"262003655","full_name":"Bike-JS/react-bem","owner":"Bike-JS","description":"BEM helper for React","archived":false,"fork":false,"pushed_at":"2023-01-06T07:15:11.000Z","size":108,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-21T05:07:16.396Z","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/Bike-JS.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":"2020-05-07T09:13:00.000Z","updated_at":"2020-09-23T17:52:06.000Z","dependencies_parsed_at":"2023-02-05T14:47:32.195Z","dependency_job_id":null,"html_url":"https://github.com/Bike-JS/react-bem","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/Bike-JS%2Freact-bem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bike-JS%2Freact-bem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bike-JS%2Freact-bem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bike-JS%2Freact-bem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bike-JS","download_url":"https://codeload.github.com/Bike-JS/react-bem/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243551234,"owners_count":20309290,"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":"2025-01-21T03:14:43.765Z","updated_at":"2025-03-14T08:43:35.008Z","avatar_url":"https://github.com/Bike-JS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React BEM\n\nThis is help package for use BEM methodology in React components\n\n## Install\n\n`npm i -S @bikejs/react-bem`\n\n## Usage\n\nExample for use as decorator\n\n```jsx harmony\nimport React from 'react';\nimport { BEM } from '@bikejs/react-bem';\n\n@BEM('my-component')\nexport class Component extends React.PureComponent {\n  render() {\n    const { bem } = this.props;\n\n    return (\n      \u003csection className={bem()}\u003e\n        \u003cheader className={bem('header')}\u003e\n          Header\n        \u003c/header\u003e\n        \u003carticle className={bem('main', { mod: true, type: 'test' })}\u003e\n          Main\n        \u003c/article\u003e\n      \u003c/section\u003e\n    );\n  }\n}\n```\n\nExample for use as hook\n\n```jsx harmony\nimport React from 'react';\nimport { useBEM } from '@bikejs/react-bem';\n\nexport const MyComponent = () =\u003e {\n  const bem = useBEM('my-component');\n\n  return (\n    \u003csection className={bem()}\u003e\n      \u003cheader className={bem('header')}\u003e\n        Header\n      \u003c/header\u003e\n      \u003carticle className={bem('main', { mod: true, type: 'test' })}\u003e\n        Main\n      \u003c/article\u003e\n    \u003c/section\u003e\n  );\n}\n```\n\n`className` proxying is also supported\n\n```jsx harmony\nimport React from 'react';\nimport { BEM } from '@bikejs/react-bem';\n\n@BEM('my-component')\nclass Component extends React.Component {\n  render() {\n    const { bem } = this.props;\n    return \u003cdiv className={bem()}/\u003e;\n  }\n}\n\n@BEM('my-app')\nclass App extends React.Component {\n  render() {\n    const { bem } = this.props;\n    return \u003cComponent className={bem()}/\u003e;\n  }\n}\n\n// App render result:\n// \u003cdiv class=\"my-app my-component\"\u003e\u003c/div\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbike-js%2Freact-bem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbike-js%2Freact-bem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbike-js%2Freact-bem/lists"}