mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
docs: Prefer const to let (auto generating selectors) (#3094)
This commit is contained in:
parent
4d3a0176ca
commit
67673947d6
@ -23,9 +23,9 @@ type WithSelectors<S> = S extends { getState: () => infer T }
|
||||
const createSelectors = <S extends UseBoundStore<StoreApi<object>>>(
|
||||
_store: S,
|
||||
) => {
|
||||
let store = _store as WithSelectors<typeof _store>
|
||||
const store = _store as WithSelectors<typeof _store>
|
||||
store.use = {}
|
||||
for (let k of Object.keys(store.getState())) {
|
||||
for (const k of Object.keys(store.getState())) {
|
||||
;(store.use as any)[k] = () => store((s) => s[k as keyof typeof s])
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user