Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@aquigorka/compose
Advanced tools
React component composition helper. Benefits:
// view should be able to handle the possible states (eg. loading)
const View = ({ value, valueLoading }) => valueLoading
? <div>Loading...</div>
: <div>{value}</div>
// store: get, put, post, delete, etc
class Store extends Component {
state = { value: null, loading: false }
render() {
const { children, ...rest } = this.props
const { value, loading } = this.state
<Fragment>
{Children.map(children, child =>
cloneElement(child, {
...rest,
valueGet: this.get,
valuePost: this.post,
valueLoading: loading,
value
}),
)}
</Fragment>
}
get = () => {
// fetch value
this.setState({ loading: true })
setTimeout(() => this.setState({ value: 1, loading: false }), 1000)
}
post = () => { /*...*/ }
}
// side effects, like fetching value on mount
class Saga extends Component {
componentDidMount() {
this.props.valueGet()
}
render() {
const { children, ...props } = this.props
const { valuePost, ...rest } = props
<Fragment>
{Children.map(children, child =>
cloneElement(child, { ...rest, valuePost: this.post }),
)}
</Fragment>
}
post = data => {
// handle side effects, then dispatch the action further up
// possible side effect eg. some other request
this.props.post(data)
}
}
const SagaStore = Compose(Store, Saga)
export { SagaStore as Store, View }
export default Compose(SagaStore, View)
FAQs
React component composition helper
The npm package @aquigorka/compose receives a total of 1 weekly downloads. As such, @aquigorka/compose popularity was classified as not popular.
We found that @aquigorka/compose 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 uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.