I am using react-bootstrap Button in my application, and I want to declare the class ButtonPageChange class that extends Button to define the value 'btn-loading' in the property className.
Without using typescript I have the following React component:
export const ButtonPageChange = ({onClick, href, disabled, variant, size, className, children}) => {
return (
<Button onClick={onClick}
href={href}
disabled={disabled}
variant={variant}
size={size}
className={'btn-loading ' + className ? className : ''}
data-senna-off="true"
>
{children}
</Button>
)
};
How you can see i have to pass all the props to the Button component. I wanted to use Typescript to make this ButtonPageChange more clean. This is not a syntactically correct code but to give you an idea:
declare class ButtonPageChange extends Button {
className: {'btn-loading ' + props.className},
data-senna-off: "true"
}
I am starting with Typescript and I don't have any idea how to do this. Thanks