【发布时间】:2022-01-19 12:30:06
【问题描述】:
我有一个为我的 React Web 应用程序编写的按钮代码。我有一个三元运算符,如果加载则显示 Loader,如果加载则显示 children。我正在使用 Materialize CSS library 为其添加一些按钮样式,但它不起作用,我不知道为什么请帮助我。
export const DeprecatedButtonWithLoading: FC<
{
readonly isLoading: boolean
} & DeprecatedButtonProps
> = ({ isLoading, children, ...buttonProps }) => {
return (
<DeprecatedButton {...buttonProps}>
{isLoading ? <Loader /> : children }
</DeprecatedButton>
)
}
【问题讨论】:
标签: css typescript materialize conditional-operator react-component