您如何修复未终止的JSX内容?

发布于 2025-02-11 20:51:33 字数 912 浏览 0 评论 0原文

我一直在使用React-Native尝试创建一个简单的应用程序。但是,我对此非常陌生,我不知道自己在做什么。 这是我的代码:

import React from 'react'
import { View, Text, Button } from 'react-native'
import { useNavigation } from "@react-navigation/core";

const HomeScreen = () => {

   const navigation= useNavigation();
   return (
       <View>
         <Text>I am the home screen<Text/>
         <Button title="Go to Chat Screen"
         onPress={() => navigation.navigate("Chat")}
         />
       </View>
   )
}
export default HomeScreen

这是错误:

SyntaxError: C:\Users\Owner\CornellDatingRemix\screens\HomeScreen.js: Unterminated JSX contents. (13:15)

  11 |           onPress={() => navigation.navigate("Chat")}
  12 |           />
> 13 |         </View>
     |                ^
  14 |     )
  15 | }
  16 | export default HomeScreen

如何解决此问题?

I have been using react-native to try and create just a simple app. However, I am very new to this and I have no clue what I am doing.
This is my code:

import React from 'react'
import { View, Text, Button } from 'react-native'
import { useNavigation } from "@react-navigation/core";

const HomeScreen = () => {

   const navigation= useNavigation();
   return (
       <View>
         <Text>I am the home screen<Text/>
         <Button title="Go to Chat Screen"
         onPress={() => navigation.navigate("Chat")}
         />
       </View>
   )
}
export default HomeScreen

Here is the error:

SyntaxError: C:\Users\Owner\CornellDatingRemix\screens\HomeScreen.js: Unterminated JSX contents. (13:15)

  11 |           onPress={() => navigation.navigate("Chat")}
  12 |           />
> 13 |         </View>
     |                ^
  14 |     )
  15 | }
  16 | export default HomeScreen

How do I fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半世晨晓 2025-02-18 20:51:33

您只有一个错别字:

const HomeScreen = () => {

   const navigation= useNavigation();
   return (
       <View>
         <Text>I am the home screen<Text/> /// should be </Text>
         <Button title="Go to Chat Screen"
         onPress={() => navigation.navigate("Chat")}
         />
       </View>
   )
}
export default HomeScreen

You just have a typo:

const HomeScreen = () => {

   const navigation= useNavigation();
   return (
       <View>
         <Text>I am the home screen<Text/> /// should be </Text>
         <Button title="Go to Chat Screen"
         onPress={() => navigation.navigate("Chat")}
         />
       </View>
   )
}
export default HomeScreen
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文