import React, { forwardRef } from 'react'; import { Box, BoxProps, SpinnerProps } from '@chakra-ui/react'; import Loading from '../MyLoading'; type Props = BoxProps & { isLoading?: boolean; text?: string; size?: SpinnerProps['size']; }; const MyBox = ({ text, isLoading, children, size, ...props }: Props, ref: any) => { return ( {children} {isLoading && } ); }; export default React.memo(forwardRef(MyBox));