我正在使用NativeBase和React Native。
NativeBase 按钮以这种方式创建:
<Button warning>
<Text>Hello</Text>
</Button>
Run Code Online (Sandbox Code Playgroud)
您可以使用不同的类型,例如info或success ,而不是警告。
现在,我想基于道具创建这些按钮并尝试执行以下操作:
<Button {this.props.type}>
<Text>Hello</Text>
</Button>
Run Code Online (Sandbox Code Playgroud)
但我找不到办法做到这一点,因为这个道具没有价值。
是否可以传递没有值的 props?