Javascript …反应本机函数组件中的属性

Javascript …反应本机函数组件中的属性,javascript,react-native,spread-syntax,Javascript,React Native,Spread Syntax,我在react原生应用程序中有以下功能组件。在第二行代码中,有…属性,这让人困惑。虽然我知道它在较新的JavaScript版本中代表了扩展语法,但我找不到属性的含义。如果它说.props,那么这是可以理解的。我试着用谷歌搜索,但找不到合适的答案 问题 在下面代码段的第二行中,attributes表示什么 const Loader = (props) => { const { loading, loaderColor, loaderText, ...attributes } = pr

我在react原生应用程序中有以下功能组件。在第二行代码中,有
…属性
,这让人困惑。虽然我知道它在较新的JavaScript版本中代表了扩展语法,但我找不到
属性
的含义。如果它说
.props
,那么这是可以理解的。我试着用谷歌搜索,但找不到合适的答案

问题

在下面代码段的第二行中,
attributes
表示什么

  const Loader = (props) => {
  const { loading, loaderColor, loaderText, ...attributes } = props;

  return (
    <Modal
      transparent={true}
      animationType={'none'}
      visible={loading}
      onRequestClose={() => {
        console.log('close modal');
      }}>
      <View style={styles.modalBackground}>
        <View style={styles.activityIndicatorWrapper}>
          <ActivityIndicator
            animating={loading}
            color={loaderColor? loaderColor : '#0000ff'}
            size={Platform.OS === 'ios' ? 'large' : 75}
          />
          {loaderText ? (
            <View style={{ flexDirection: 'row' }}>
              <Text style={styles.modalText}>{loaderText}</Text>
            </View>
          ) : (
            ''
          )}
        </View>
      </View>
    </Modal>
  );
};
const-Loader=(道具)=>{
常量{loading,loaderColor,loaderText,…attributes}=props;
返回(
{
console.log(“关闭模式”);
}}>
{loaderText(
{loaderText}
) : (
''
)}
);
};

attributes
是新创建的常量的名称,该常量包含
props
中的rest属性

const{
A.
B
…对象包含除选项卡之外的所有其他属性
} = {
答:1,,
b:2,
c:3,
d:4
};

log(objectContainingEveryOtherPropertyExceptAB)代码来自哪里?这是我在react原生应用程序中看到的组件。回答得很好。谢谢所以
.attributes
意味着attributes常量将包含除以下属性之外的所有属性:loading、loaderColor、loaderText。很酷的构造。回到ocd代码段中的组件,我认为上面的代码中并不需要
…attributes
,因为它没有在加载程序组件中使用。使用对象解构来设置loading、loaderColor、loaderText已经足够了,使用这行代码:
{loading、loaderColor、loaderText}=props
一个问题与未设置加载属性的
示例有关。它是否自动设置为未定义或空?