【发布时间】:2021-11-06 18:40:53
【问题描述】:
我正在使用 Material-UI v4 在“Snackbar”上创建自定义过渡。默认情况下,转换工作,但是当我尝试添加自己的转换时,我遇到了类型问题。
过渡代码:
<SnackbarProvider
maxSnack={3}
TransitionComponent={React.forwardRef(function Transition(
props,
ref
) {
return <Slide direction="up" ref={ref} {...props} />
})}
>
将鼠标悬停在幻灯片上时显示错误:
Types of property 'children' are incompatible.
Type 'ReactNode' is not assignable to type 'ReactElement<any, any> | undefined'.
Type 'null' is not assignable to type 'ReactElement<any, any> | undefined'.ts(2322)
【问题讨论】:
标签: reactjs typescript material-ui