猿问

跪求大侠这个箭头函数里的参数如何解释?

import React from 'react';


import { StyleSheet, Text } from 'react-native';


/**

 * Used across examples as a screen placeholder.

 */

import type { Children } from 'react';


const SampleText = ({children}: { children?: Children }) => (

  <Text style={styles.sampleText}>ww{children}</Text>

);


export default SampleText;


const styles = StyleSheet.create({

  sampleText: {

    margin: 14,

  },

});

({children}: { children?: Children })


括号里的是啥意思?感觉不像三目运算符,谢谢!


青春有我
浏览 454回答 1
1回答

慕田峪4524236

这是flow的语法,表示children是Children类型的可选属性详见Interface Properties
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答