![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
derive-zustand
Advanced tools
A function to create a derived Zustand store from stores
npm install zustand derive-zustand
import { create, useStore } from 'zustand';
import { derive } from 'derive-zustand';
const useCountStore = create<{ count: number; inc: () => void }>((set) => ({
count: 0,
inc: () => set((state) => ({ count: state.count + 1 })),
}));
const doubleCountStore = derive<number>((get) => get(useCountStore).count * 2);
const useDoubleCountStore = () => useStore(doubleCountStore);
const Counter = () => {
const { count, inc } = useCountStore();
const doubleCount = useDoubleCountStore();
return (
<div>
<div>count: {count}</div>
<div>doubleCount: {doubleCount}</div>
<button type="button" onClick={inc}>
+1
</button>
</div>
);
};
The examples folder contains working examples. You can run one of them with
PORT=8080 pnpm run examples:01_counter
and open http://localhost:8080 in your web browser.
[0.1.1] - 2024-06-03
FAQs
A function to create a derived Zustand store from stores
The npm package derive-zustand receives a total of 3,414 weekly downloads. As such, derive-zustand popularity was classified as popular.
We found that derive-zustand demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.