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.
A tiny higher order component to manage AJAX requests in React components.
componentWillUnmount
.pending
state as a property.import React from 'react';
import jax from 'react-jax';
import superagent from 'superagent';
@jax(superagent)
export default class MyComponent extends React.Component {
sendRequest = () => {
this.props.get('https://example.com').end((err, res) => {
// your code
});
}
render() {
return this.props.pending ?
<button onClick={this.sendRequest}>Click Me</button> :
<button onClick={this.props.abort}>Cancel</button>;
}
}
@jax(options)
export default class Test extends React.Component {
/* your code */
}
class Test extends React.Component {
/* your code */
}
export default jax(options)(Test);
You can choose to pass a superagent client or an object for additional options.
These options can be passed to the jax()
decorator.
client
requiredmethods
defaults to ['get', 'post', 'del', 'put']
Array of jax methods to expose as properties.
pendingKey
defaults to pending
Property name to expose the pending status as.
abortKey
defaults to abort
Property name to expose the abort function as.
endEvents
defaults to ['end', 'abort', 'error']
Events emitted by the clients request object than indicate it should be cleaned up.
props[abortKey]() -> undefined
Aborts all pending requests sent by the component.
props[pendingKey] -> boolean
Returns true if any request sent by the component are pending.
props[method](...args) -> req
Exact same function signature the client
exposes.
For example, superagent will expose functions like these.
FAQs
A tiny decorator to manage AJAX requests in React components.
We found that react-jax 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.