我尝试将流与React一起使用,但是发现一些奇怪的行为,如果我尝试将React中的HTMLProps包含到组件Props类型中,流将引发错误“无法获取React.HTMLProps,因为模块中缺少属性HTMLProps反应”
组件:
const Row = (
{
jc,
ai,
children,
...rest
}: RowProps & React.HTMLProps<HTMLDivElement>
) => (
<RowW
justifyContent={jc}
alignItems={ai}
{...rest}>
{children}
</RowW>
)
流的错误:
Cannot get React.HTMLProps because property HTMLProps is missing in module react [1].
[1] 2│ import * as React from 'react'
:
21│ ai,
22│ children,
23│ ...rest
24│ }: RowProps & React.HTMLProps<HTMLDivElement>
25│ ) => (
26│ <RowW
27│ justifyContent={jc}
如何告诉Flow我想将'div'元素的任何属性传递给该组件?