以下是我的代码
import React from 'react'
import PropTypes from "prop-types";
export default function Button({ htmlType, type, disabled, action, ...props}) {
return (
<button type={htmlType} onClick={action}>
{props.children}
</button>
)
}
Button.propTypes = {
htmlType: PropTypes.string.isRequired,
action: PropTypes.func,
disabled: PropTypes.bool
};
我通过以下代码调用Button组件
<Button disabled={true}>button title</Button>
我想在props 禁用的时候给按钮添加禁用的html属性,该怎么做?