import React , { HTMLAttributes , PropsWithChildren } from "react" ; interface Props extends HTMLAttributes < HTMLButtonElement & HTMLAnchorElement > { isLink : boolean ; } export const ButtonOrLink = React . forwardRef < HTMLButtonElement & HTMLAnchorElement , Props > ( ( { isLink , ... props } , ref ) => { return isLink ? < a ref = { ref } { ... props } /> : <button {...props}/ > ; } ) ;