Server IP : 172.67.158.161 / Your IP : 3.135.200.4 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/home/giankuin/sieuthiweb.com.vn/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/hooks/ |
Upload File : |
/** * External dependencies */ import { useRef } from '@wordpress/element'; import isShallowEqual from '@wordpress/is-shallow-equal'; /** * A custom hook that compares the provided value across renders and returns the * previous instance if shallow equality with previous instance exists. * * This is particularly useful when non-primitive types are used as * dependencies for react hooks. * * @param {*} value Value to keep the same if satisfies shallow equality. * * @return {*} The previous cached instance of the value if the current has * shallow equality with it. */ export const useShallowEqual = ( value ) => { const ref = useRef(); if ( ! isShallowEqual( value, ref.current ) ) { ref.current = value; } return ref.current; };