Buckets:
| import { StoreApi, UseBoundStore } from 'zustand'; | |
| type WithSelectors<S> = S extends { getState: () => infer T } | |
| ? S & { use: { [K in keyof T]: () => T[K] } } | |
| : never; | |
| export const createSelectors = <S extends UseBoundStore<StoreApi<object>>>(_store: S) => { | |
| const store = _store as WithSelectors<typeof _store>; | |
| store.use = {}; | |
| for (const k of Object.keys(store.getState())) { | |
| (store.use as Record<string, () => unknown>)[k] = () => store((s) => s[k as keyof typeof s]); | |
| } | |
| return store; | |
| }; | |
Xet Storage Details
- Size:
- 512 Bytes
- Xet hash:
- 983f78cf63faf4c4373e759dee3e44065b2863fbf943b8634280819ad554871d
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.