
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
bem-components-react
Advanced tools
A factory to create react components that follow BEM methodology with first-class typescript support.
Installation:
yarn add bem-components-react
npm install --save bem-components-react
Usage:
import { bem } from 'bem-components-react'
// specify a class name and a list of variants afterwards
const Button = bem.button('button', ['large', 'small'])
function MyComponent() {
return <Button large>Click me</Button>
}
This component will render to:
<button class="button button--large">Click me</button>
// omit the second argument if the component doesn't have any modifiers
const Button = bem.button('button')
// specify an array of variants as a second argument
const Button = bem.button('button', ['large', 'small'])
// nest elements inside blocks by specifying it in the name
const Input = bem.button('dialog__input', ['error'])
// to enable a variant, pass a prop to the created component
<Button large>Click me</Button>
// you can pass any other prop to the created component
<Input error placeholder="write here"/>
// you can pass extra classNames to the component
<Button large className="foo">Click me</Button>
// will result in
<button classname="button button--large foo">Click me</button>
import { withPrefix } from 'bem-components-react'
const bem = withPrefix('myapp')
const Button = bem.button('button', ['large', 'small'])
Will render to:
<button class="myapp-button myapp-button--large">Click me</button>
FAQs
Builder for react components that follow BEM methodology
The npm package bem-components-react receives a total of 1 weekly downloads. As such, bem-components-react popularity was classified as not popular.
We found that bem-components-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.