import React from 'react' ; import isEqual from 'react-fast-compare' ; import { DeepEquals } from "../mui/DeepEquals" ; import debugIsEqual = DeepEquals . debugIsEqual ; /**
 * React.memo and React.forwardRef all in one function with deep isEqual support
 * for ease of use.
 */ export function memoForwardRef < E , P > ( component ) { return React . memo ( React . forwardRef < E , P > ( ( props , ref ) => component ( props , ref ) ) , isEqual ) ; } export function memoForwardRefDiv < P > ( component ) { return React . memo ( React . forwardRef < HTMLDivElement , P > ( ( props , ref ) => component ( props , ref ) ) , isEqual ) ; } interface IDeepMemoOpts { /**
     * Enable debug if isEqual when the props change.
     */ readonly debug ? : boolean ; } param component param opts export function deepMemo < T extends React . ComponentType < any > > ( component , opts = { } ) { const equalFunc = opts . debug ? debugIsEqual : isEqual ; return React . memo ( component , equalFunc ) ; }