
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
react-decorators
Advanced tools
A collection of react decorators to enhance components capabilities.
Feel free to open a PR with your own decorators. For large new features, please open an issue first.
The package is currently available only on npm.
npm install --save react-decorators
Everything is pretty much under construction
What is does
Injects the classnames package directly into React's className
property.
A simple JavaScript utility for conditionally joining classNames together.
...
TheclassNames
function takes any number of arguments which can be a string or object.
...
If the value associated with a given key is falsy, that key won't be included in the output.
@classNames
class MyComponent extends React.Component {
render() {
return (
<div className="classnames-examples">
<span className={['foo', 'bar']} /> {/* class="foo bar" */}
<span className={{selected: false, visible: true}} /> {/* class="visible" */}
<span className={[null, {active: true}, false, [{nested: true}]]} /> {/* class="active nested" */}
<span className={{hasClass: false}} /> {/* class="" */}
</div>
);
}
}
What is does
An extension of the classNames
decorator, it binds the
classnames package to React's className
property using the
alternate bind
version
for css-modules.
import styles from './styles.css';
@cssModules(styles)
class MyComponent extends React.Component {
render() {
return (
<div className="my-class">
// Content goes here
</div>
);
}
}
Although it mixing between ES2015+ imports
and CommonJS require
,
I find this syntax to be very readable.
@cssModules(require('./my-component.scss'))
class MyComponent extends React.Component { ... }
What is does
This decorator receives a map of property names to context consumers, and injects these the consumers values as properties to the base component.
injectContext({propName: Consumer[, ...]})
@injectContext({
theme: ThemeConsumer,
})
class MyComponent extends React.Component {
render() {
return (
<div className={this.props.theme.container}>
// Content goes here
</div>
);
}
}
FAQs
A collection of react decorators to enhance components capabilities
The npm package react-decorators receives a total of 1 weekly downloads. As such, react-decorators popularity was classified as not popular.
We found that react-decorators demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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 uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.