Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
react-only-when
Advanced tools
A declarative component for conditional rendering
npm install --save react-only-when
import Only from 'react-only-when'
<Only when={true}>
<h1>Here I Am</h1>
</Only>
import React from 'react';
import Only from 'react-only-when'
class App extends React.Component {
state = {
show: true
};
toggle = () => this.setState(state => ({ show: !state.show }));
render() {
const { show } = this.state;
return (
<div className="app">
<button onClick={this.toggle}>Toggle</button>
<Only when={show}>
<h1>Here I Am</h1>
</Only>
</div>
);
}
}
prop name | type | default | isRequired | description |
---|---|---|---|---|
children | react element | null | true | A single child element |
when | bool | false | true | When true, children will rendered as is |
hiddenMode | string | "withNull" | false | Determines how children should be hidden |
className | string | "r-o_hidden" | false | This is working in combination with hiddenMode={"withCss"} |
hiddenMode | description |
---|---|
"withNull" | Will not render the child |
"withDisplay" | Will render the child with display:none |
"withVisibility" | Will render the child with visibility:hidden |
"withCss" | Will render the child with a CSS class (you can pass it a custom className prop) |
MIT © sag1v
FAQs
> A declarative component for conditional rendering
The npm package react-only-when receives a total of 18,095 weekly downloads. As such, react-only-when popularity was classified as popular.
We found that react-only-when 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.