![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
bem-cx is designed for generating css classNames for use primarily in react components. It doesn't depend on react, so you could use it elsewhere.
bem-cx is designed for generating css classNames for use primarily in react components. It doesn't depend on react, so you could use it elsewhere.
npm install bem-cx
The docs can be found in the docs directory, though they might not make sense without the examples below.
There are two flavors of bem-cx. The first is very simple but requires more typing. The example is in JSX.
import makeBem from 'bem-cx'; // or require('bem-cx').default
const bem = makeBem('Foo');
class Foo {
render(){
return (
<div className={bem}>
Foo
<div className={bem.el('Header')}>
Foo__Header
<div className={bem.el('Header').el('Title')}>
Foo__Header__Title
</div>
</div>
<div className={bem.el('Content')}>
<div className={bem.el('Content').el('Example').mod(true && 'active')}>
Foo__Content__Example Foo__Content__Example--active
</div>
<div className={bem
.el('Content')
.el('Example')
.mod({
a: true,
b: false,
c: false
})}
>
Foo__Content__Example
Foo__Content__Example--a
Foo__Content__Example--c
</div>
</div>
</div>
);
}
}
This is the same as above but uses CxStack. CxStack has the same
api as the above but also provides .elAt
takes a level as its first argument.
Level 0 is the root, so direct children of the root node will have the level 1.
This saves you from needing to type everything on the hierarchy for each element.
Aside from .mod
this is the main value proposition of this library.
import {CxStack} from 'bem-cx'; // or require('bem-cx').CxStack
class Foo {
render(){
const bem = new CxStack('Foo');
return (
<div className={bem}>
Foo
<div className={bem.elAt(1, 'Header')}>
Foo__Header
<div className={bem.elAt(2, 'Title')}>
Foo__Header__Title
</div>
</div>
<div className={bem.elAt(1, 'Content')}>
<div className={bem.elAt(2, 'Example').mod(true && 'active')}>
Foo__Content__Example Foo__Content__Example--active
</div>
<div className={bem
.elAt(2, 'Example')
.mod({
a: true,
b: false,
c: false
})}
>
Foo__Content__Example
Foo__Content__Example--a
Foo__Content__Example--c
</div>
</div>
</div>
);
}
}
FAQs
bem-cx is designed for generating css classNames for use primarily in react components. It doesn't depend on react, so you could use it elsewhere.
The npm package bem-cx receives a total of 2 weekly downloads. As such, bem-cx popularity was classified as not popular.
We found that bem-cx 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.