【发布时间】:2018-05-30 00:27:39
【问题描述】:
我正在使用 React Native 制作应用程序。 我注意到奇怪的事情。
除非我将最后一句更改为
,否则这段代码会出错export default MyButton3;
我想为每个文件导出多个纯组件。如果我不使用纯组件声明,我可以这样做。
但为什么我不能用纯组件做到这一点?
谢谢。
const MyButton3 = (props) => (
<TouchableOpacity style={[props.style,{height:40, backgroundColor:Asset.color_skyblue, justifyContent:'center'}]} onPress={props.onPress}>
<Text style={{color:'white', alignSelf:'center', fontSize:20, fontWeight:'bold'}}>{props.title}</Text>
</TouchableOpacity>
);
export MyButton3;
【问题讨论】:
-
我想这解释了我的问题。 stackoverflow.com/questions/31852933/…
标签: reactjs react-native