0

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?

1 Answer 1

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.