
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@digitalentities/react-hook-bem
Advanced tools
A React library implementing the BEM concept for Sass.
yarn add @digitalentities/react-hook-bem
#or
npm install @digitalentities/react-hook-bem
/*
* Component.tsx
*/
// All DOM elements are prefixed by $
import { $div, $main, Styles } from "@digitalentities/react-hook-bem";
// import styles as module
// https://github.com/css-modules/css-modules
import styles from "./App.module.scss";
// ...
return (
// inject styles
<Styles value={styles}>
// define a BEM block by using $block
// output: <main class="app">
<$main $block="app">
// define a BEM element by using $element
// output: <div class="app__container">
<$div $element="container">
// use a BEM modifier by using $modifier, multiple modifiers are possible
// output:
// <div class="app__container__click> when clicked === false
// <div class="app__container__click app__container__click--hidden"> when clicked === true
<$div
$element="click"
$modifier={{
hidden: clicked,
}}
>
Hello world!
</$div>
</$div>
</$main>
</Styles>
);
/*
* App.module.scss
*/
.app {
background-color: red;
&__container {
margin: 0 auto;
&__click {
/*! keep - so scss compiles empty class */
&--hidden {
display: none;
}
}
}
}
You can wrap your own components with the provided withBEM wrapper:
import { YourComponent } from "./YourComponent";
import { withBEM } from "react-hooks-bem";
export const $YourComponent = withBEM(YourComponent);
You can find a complete example in ./example.
# Step 1:
# in project root
yarn install
# Step 2:
# in project root
cd example
yarn install
# Step 3:
# in project root
# See: https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react
cd example/node_modules/react
yarn link
# in project root
yarn link "react"
# Step 4
# Build library
# in project root
yarn build
# Step 5
# Start example app
cd example
yarn start
FAQs
BEM for React
The npm package @digitalentities/react-hook-bem receives a total of 0 weekly downloads. As such, @digitalentities/react-hook-bem popularity was classified as not popular.
We found that @digitalentities/react-hook-bem 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.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.