import {cacheComputed} from "../utils/cacheComputed"; import {StyleProperties} from "../type"; export function useStyleCache( fn: (styles: StyleProperties) => StyleProperties | void ) { const _fn = () => { const style = {}; return fn(style) || style; }; return cacheComputed(_fn, (newValue, oldValue) => JSON.stringify(newValue) !== JSON.stringify(oldValue)); }