How can I extend in SolidJS props of some existing JSX element and create my custom interface like this ButtonProps
interface in the given below example for React.
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>
);
};
In very much the same way, except you need to avoid destructuring for reactive properties and use splitProps instead, so your example would translate to:
As you can see, the types of the intrinsic element attributes are in JSX, coming from the jsx-dom-expressions that convert JSX to reactive expressions in solid.