Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zustand

Package Overview
Dependencies
Maintainers
3
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zustand - npm Package Compare versions

Comparing version 4.4.3 to 4.4.4

2

package.json
{
"name": "zustand",
"private": false,
"version": "4.4.3",
"version": "4.4.4",
"description": "🐻 Bear necessities for state management in React",

@@ -6,0 +6,0 @@ "main": "./index.js",

@@ -228,3 +228,3 @@ <p align="center">

const store = createStore(() => ({ ... }))
const store = createStore((set) => ...)
const { getState, setState, subscribe } = store

@@ -251,3 +251,3 @@

```jsx
const useScratchStore = create(set => ({ scratches: 0, ... }))
const useScratchStore = create((set) => ({ scratches: 0, ... }))

@@ -392,3 +392,3 @@ const Component = () => {

// Usage with a plain action store, it will log actions as "setState"
const usePlainStore = create(devtools(store))
const usePlainStore = create(devtools((set) => ...))
// Usage with a redux store, it will log full action types

@@ -404,4 +404,4 @@ const useReduxStore = create(devtools(redux(reducer, initialState)))

// Usage with a plain action store, it will log actions as "setState"
const usePlainStore1 = create(devtools(store, { name, store: storeName1 }))
const usePlainStore2 = create(devtools(store, { name, store: storeName2 }))
const usePlainStore1 = create(devtools((set) => ..., { name, store: storeName1 }))
const usePlainStore2 = create(devtools((set) => ..., { name, store: storeName2 }))
// Usage with a redux store, it will log full action types

@@ -416,5 +416,5 @@ const useReduxStore = create(devtools(redux(reducer, initialState)), , { name, store: storeName3 })

Name store: `devtools(store, {name: "MyStore"})`, which will create a separate instance named "MyStore" in the devtools.
Name store: `devtools(..., {name: "MyStore"})`, which will create a separate instance named "MyStore" in the devtools.
Serialize options: `devtools(store, { serialize: { options: true } })`.
Serialize options: `devtools(..., { serialize: { options: true } })`.

@@ -428,10 +428,10 @@ #### Logging Actions

```jsx
const createBearSlice = (set, get) => ({
eatFish: () =>
set(
(prev) => ({ fishes: prev.fishes > 1 ? prev.fishes - 1 : 0 }),
false,
'bear/eatFish'
),
})
const useBearStore = create(devtools((set) => ({
...
eatFish: () => set(
(prev) => ({ fishes: prev.fishes > 1 ? prev.fishes - 1 : 0 }),
false,
'bear/eatFish'
),
...
```

@@ -442,9 +442,9 @@

```jsx
const createBearSlice = (set, get) => ({
addFishes: (count) =>
set((prev) => ({ fishes: prev.fishes + count }), false, {
type: 'bear/addFishes',
count,
}),
})
...
addFishes: (count) => set(
(prev) => ({ fishes: prev.fishes + count }),
false,
{ type: 'bear/addFishes', count, }
),
...
```

@@ -451,0 +451,0 @@

@@ -86,4 +86,4 @@ 'use strict';

module.exports = shallow$1;
module.exports.shallow = shallow;
module.exports = shallow;
module.exports.shallow = shallow$1;
exports.default = module.exports;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc