MCPcopy
hub / github.com/pmndrs/zustand / subscribe

Function subscribe

src/vanilla.ts:88–92  ·  view source on GitHub ↗
(listener)

Source from the content-addressed store, hash-verified

86 initialState
87
88 const subscribe: StoreApi<TState>['subscribe'] = (listener) => {
89 listeners.add(listener)
90 // Unsubscribe
91 return () => listeners.delete(listener)
92 }
93
94 const api = { setState, getState, getInitialState, subscribe }
95 const initialState = (state = createState(setState, getState, api))

Callers 2

basic.test.tsxFile · 0.85
subscribe.test.tsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…