Ume*_*mer 5 javascript reactjs flowtype react-props
我尝试将 flow 与 React 一起使用,但发现了一些奇怪的行为,如果我尝试将 React 中的 HTMLProps 包含到组件 Props 类型中,flow 会抛出错误“无法获取 React.HTMLProps,因为模块 React 中缺少属性 HTMLProps”
\n\n成分:
\n\nconst Row = (\r\n {\r\n jc,\r\n ai,\r\n children,\r\n ...rest\r\n }: RowProps & React.HTMLProps<HTMLDivElement>\r\n) => (\r\n <RowW\r\n justifyContent={jc}\r\n alignItems={ai}\r\n {...rest}>\r\n {children}\r\n </RowW>\r\n)Run Code Online (Sandbox Code Playgroud)\r\n流程错误:
\n\nCannot get React.HTMLProps because property HTMLProps is missing in module react [1].\r\n\r\n [1] 2\xe2\x94\x82 import * as React from \'react\'\r\n :\r\n 21\xe2\x94\x82 ai,\r\n 22\xe2\x94\x82 children,\r\n 23\xe2\x94\x82 ...rest\r\n 24\xe2\x94\x82 }: RowProps & React.HTMLProps<HTMLDivElement>\r\n 25\xe2\x94\x82 ) => (\r\n 26\xe2\x94\x82 <RowW\r\n 27\xe2\x94\x82 justifyContent={jc}Run Code Online (Sandbox Code Playgroud)\r\n我如何告诉 Flow 我想将“div”元素的任何属性传递给该组件?
\n| 归档时间: |
|
| 查看次数: |
395 次 |
| 最近记录: |