0
これは、実際には、ReactまたはReact Nativeの使用タイプについてはドキュメントレスです。リアクションエレメントのフロータイプ
の要素タイプがrender()
functionにあることがわかりました。
// @flow
import React from 'react';
import { Text } from 'react-native';
function greetingTextNode(string: string): React$Element<any> {
return (
<Text>Greeting, { string }.</Text>
)
}
が、それはコンソールでflowtypeエラーを示しています:だから私は私のコードでこれを試してみてください
20: <Text>Greeting, { string }.</Text>
^^^^^^ Text. This type is incompatible with
97: type _ReactClass<DefaultProps, Props, Config: $Diff<Props, DefaultProps>, C: React$Component<DefaultProps, Props, any>> = Class<C>;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ React$Component. See lib: /private/tmp/flow/flowlib_243350bf/react.js:97
はどのように反応要素のフロータイプを修正することができますか?
、正しい考え方を持っていましたか? –
'*'を使用すると、そのタイプを推論するためにFlowに指示します。 https://flow.org/en/docs/types/utilities/#toc-the-existential-type – evanflash