Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
zustand-mutative
Advanced tools
A Mutative middleware for Zustand enhances the efficiency of immutable state updates.
A Mutative middleware for Zustand enhances the efficiency of immutable state updates.
With the Mutative middleware, you can simplify the handling of immutable data in Zustand in a mutable way, allowing you to use immutable state more conveniently.
zustand-mutative
is 2-6x faster than zustand with spread operation, more than 10x faster than zustand/middleware/immer
. Read more about the performance comparison in Mutative.
In order to use the Mutative middleware in Zustand, you will need to install Mutative and Zustand as a direct dependency.
npm install zustand-mutative zustand mutative
# Or use any package manager of your choice.
import { create } from 'zustand';
import { mutative } from 'zustand-mutative';
type State = {
count: number;
};
type Actions = {
increment: (qty: number) => void;
decrement: (qty: number) => void;
};
export const useCountStore = create<State & Actions>()(
mutative((set) => ({
count: 0,
increment: (qty: number) =>
set((state) => {
state.count += qty;
}),
decrement: (qty: number) =>
set((state) => {
state.count -= qty;
}),
}))
);
zustand-mutative
is inspired by zustand/middleware/immer
.
zustand-mutative
is MIT licensed.
FAQs
A Mutative middleware for Zustand enhances the efficiency of immutable state updates.
The npm package zustand-mutative receives a total of 1,927 weekly downloads. As such, zustand-mutative popularity was classified as popular.
We found that zustand-mutative demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.