
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
better-zustand-selector
Advanced tools
A better way to use selectors with zustand that allows you to access multiple states from the store at once without causing unnecessary re-renders.
npm install better-zustand-selector
pnpm install better-zustand-selector
yarn add better-zustand-selector
Try it out on Code Sandbox
import { create } from "zustand";
import { createSelector } from "better-zustand-selector";
const counterStore = create((set) => ({
count: 0,
increment: () => set((state) => ({ count: state.count + 1 })),
}));
const useCounterStore = createSelector(counterStore);
const Counter = () => {
const { count, increment } = useCounterStore("count", "increment");
return <button onClick={increment}>{count}</button>;
};
You can also retrieve partial states from the store without causing re-renders when the unaccessed states change.
For example, if you only want to access the count
state from the store, you can use the useCounterStore
hook like this:
const { count } = useCounterStore("count");
FAQs
A better way to use selectors with zustand
The npm package better-zustand-selector receives a total of 2 weekly downloads. As such, better-zustand-selector popularity was classified as not popular.
We found that better-zustand-selector 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.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.