(func)
| 2 | import { create } from 'zustand' |
| 3 | |
| 4 | function 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 | |
| 16 | const useXxxStore = create((set) => ({ |
| 17 | aaa: '', |
nothing calls this directly
no outgoing calls
no test coverage detected