MCPcopy Create free account
hub / github.com/QuarkGluonPlasma/react-course-code / logMiddleware

Function logMiddleware

zustand-test/src/App.js:4–14  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

2import { create } from 'zustand'
3
4function logMiddleware(func) {
5 return function(set, get, store) {
6
7 function newSet(...args) {
8 console.log('调用了 set:', get());
9 return set(...args)
10 }
11
12 return func(newSet, get, store)
13 }
14}
15
16const useXxxStore = create((set) => ({
17 aaa: '',

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected