【发布时间】:2019-05-13 01:59:56
【问题描述】:
我在我的 react-native 项目中使用 Atom 编辑器。当我在 Atom 中注释掉我的代码并运行它时,我会收到一条错误消息,指出必须在组件中呈现文本字符串。
我认为这是 Atom 编辑器问题。我可以使用cmd + / 注释掉代码,但这会在我运行代码时引发错误。
class RegisterScreen extends Component {
render() {
return (
<View style={{flex:1}}>
//this is profile text
<View style={{width:'100%', height:70, justifyContent:'flex-start', alignItems:'flex-start',backgroundColor:'blue'}}>
<Text style={{paddingLeft:20, paddingTop:20, fontSize: 20, fontWeight:'bold'}}> profile </Text>
</View>
</View>
)
}
}
【问题讨论】:
-
显示一些注释代码,可能你不小心把括号注释掉了
-
我刚刚编辑了我的问题。
-
要注释掉模板中的代码,我相信它需要是
<!--和-->对。 -
实际上当我发表评论并使用
cmd+/时会发生错误 -
如果你手动使用
<!--和-->注释掉你的代码并且它没有返回错误,那么它确认Atom对react文件的注释功能是错误的。