UNPKG

@guruhotel/aura-hooks

Version:

🪝 Hooks library designed by the Guruhotel team for Aura UI

1 lines 407 B
import{useEffect as r,useRef as t}from"react";import{shallowEqual as e}from"../utils/shallow-equal/shallow-equal";function n(r){const n=t([]),u=t(0);return function(r,t){if(!r||!t)return!1;if(r===t)return!0;if(r.length!==t.length)return!1;for(let n=0;n<r.length;n+=1)if(!e(r[n],t[n]))return!1;return!0}(n.current,r)||(n.current=r,u.current+=1),[u.current]}export function useShallowEffect(t,e=[]){r(t,n(e))}