Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
redux-query
Advanced tools
Redux-query places several constraints in order to bring a consistent, declarative mechanisms for fetching, storing, and updating remote data:
As different endpoints can have subtle differences in their responses, redux-query does not place constraints or make assumptions about the shape of the response data, except that it is parseable JSON. This places the responsibility on the client to handle how data is transformed and reconciled with previously-stored data.
The recommended way to trigger a request is to use the connectRequest React component class wrapper. This wrapper will leverage the React lifecycle methods to trigger new requests when the component mounts and updates. It will also cancel in-flight requests when the component unmounts.
Example usage:
import { connectRequest } from 'redux-query';
class Funnels extends Component {
...
}
const FunnelsContainer = connectRequest((props) => ({
url: '/config/funnels',
transform: normalizeFunnelsResponse,
update: {
funnels: (prevFunnels, funnels) => funnels,
funnelsById: (prevFunnelsById, funnelsById) => ({ ...prevFunnelsById, ...funnelsById }),
},
}))(Funnels);
Mutations can be triggered by dispatching a mutateAsync
action. For example:
import { mutateAsync } from 'redux-query';
export const removeFunnel = (id) => mutateAsync({
url: '/config/funnels/remove',
body: { id },
transform: normalizeFunnelsResponse,
update: {
funnels: (prevFunnels, funnels) => funnels,
funnelsById: (prevFunnelsById, funnelsById) => ({ ...prevFunnelsById, ...funnelsById }),
},
});
Mutation actions can be dispatched by other async actions using redux-thunk. This allows you to query the redux state to compose the body for the mutation request.
The queryMiddleware is responsible for intercepting REQUEST_ASYNC
and MUTATE_ASYNC
actions, performing the queries,
and dispatching other actions that can alter the queries and entities reducer states.
FAQs
A library for querying and managing network state in Redux applications
The npm package redux-query receives a total of 13,832 weekly downloads. As such, redux-query popularity was classified as popular.
We found that redux-query demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.