Answers for "react inherit html input props"

0

react inherit html input props

import React from 'react';

interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
  title: string;
  showIcon: boolean;
}

const Button: React.FC<ButtonProps> = ({ title, showIcon, ...props }) => {
  return (
    <button {...props}>
      {title}
      {showIcon && <Icon/>}
    </button>
  );
};
Posted by: Guest on June-12-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language