如何在React Native中的Return中编写JSX代码?

时间:2019-05-27 07:26:51

标签: mongodb react-native

我正在尝试将我的React Native App连接到远程MongoDB服务器。试图在我的应用程序返回中编写JSX语句。

return (
            <View style={styles.container}>
                <Text> {loginStatus}</Text>
                {this.state.currentUserId !== undefined ? logoutButton : loginButton}
                {this.state.name !== undefined ? <Text>{this.state.welcomeText}</Text> : this.state.currentUserId !== undefined ? nameInput : ""}
                {(this.state.name == undefined) && this.state.tempName !== undefined ? confirmNameButton : ""}
            </View>
        )

如果找到名称,则应该将“欢迎消息”设置为该状态。如果用户已登录,则显示注销按钮,否则显示登录按钮。 我不断收到此错误: ReactNativeJS:始终违规:文本字符串必须在组件内呈现。

0 个答案:

没有答案