簡體   English   中英

反應原生定義道具類型

[英]react native define props type

我不知道'<'道具'>'。 尋找使用道具,我發現使用另一個道具 為什么道具是使用“類型”和'<'道具'>'? 什么意思? 請回答我的問題

type Props = {};
export default class App extends Component<Props> {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome to React Native!</Text>
        <Text style={styles.instructions}>To get started, edit App.js</Text>
        <Text style={styles.instructions}>{instructions}</Text>
      </View>
    );
  }
}

語法來自'flow'。

Flow 是 javascript 的靜態類型檢查器以獲取更多信息,請訪問

https://flow.org/en/docs/react/components/

您可以刪除type Props = {}; 然后刪除Component<Props> 'props' ,然后開始編碼

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM