refactor: clean code

This commit is contained in:
Fu Diwei
2025-01-10 21:22:22 +08:00
parent e4e0a24a06
commit 8ed2b2475c
4 changed files with 31 additions and 27 deletions

View File

@@ -18,11 +18,11 @@ export type UseZustandShallowSelectorReturns<T extends object, TKeys extends key
* const { foo, bar, baz } = useStore(useZustandShallowSelector(["foo", "bar", "baz"]));
*
* // 以上代码等效于:
* const { foo, bar, baz } = useStore((state) => ({
* const { foo, bar, baz } = useStore(useShallow((state) => ({
* foo: state.foo,
* bar: state.bar,
* baz: state.baz,
* }));
* })));
* ```
*/
const useZustandShallowSelector = <T extends object, TKeys extends keyof T>(paths: MaybeMany<TKeys>): UseZustandShallowSelectorReturns<T, TKeys> => {