med-notes/.pnpm-store/v10/files/01/6562b3a472609e90fe65ed687af39655f77878d9c0bac74c180098fc7b2768d0a31dac4f3cf9e4d49a561353ad9c65f2976edb246ad46feb3c62ae906fa35f
2025-05-09 05:30:08 +02:00

13 lines
315 B
Plaintext

import React from 'react';
import { shallow } from 'zustand/vanilla/shallow';
function useShallow(selector) {
const prev = React.useRef(undefined);
return (state) => {
const next = selector(state);
return shallow(prev.current, next) ? prev.current : prev.current = next;
};
}
export { useShallow };