Sujeet kumar
Sujeet kumar

Reputation: 66

React native Render Error how to solve this

Render Error
Error: Text strings must be rendered within a <Text> component.

How to fix the above error in React Native? Here is my code: Challenge1.jsx

import { View, Text, StyleSheet } from "react-native-web";
function Challenge1() {
    return (<View>
        <Text style={style.first}>
            Welcome to Thapa Technical Channel
        </Text>
        <Text style={style.second}>
            We love React native and i'm a subscriber of thapa technical channel
        </Text>
        <Text style={style.third}>
            Hii, My name is
        </Text>
    </View>)
}

const style = StyleSheet.create({
    first: {
        fontSize: 40,
        textAlign: "center",
        fontWeight: "bold"
    },
    second: {
        fontSize: 30,
        textAlign: "center"

    },
    third: {
        fontSize: 20,
        textAlign: "center",
        fontWeight: "bold"

    },
})
export default Challenge1;

Here is some information:

Error: Text strings must be rendered within a component.

This error is located at: in div (created by Text) in Text (created by Challenge1) in div (created by View) in View (created by Challenge1) in Challenge1 (created by App) in RCTText (created by Text) in Text (created by App) in RCTView (created by View) in View (created by App) in App (created by ExpoRoot) in ExpoRoot in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer in main(RootComponent)

Upvotes: 1

Views: 2082

Answers (1)

Safeer Ahmad
Safeer Ahmad

Reputation: 21

When you save code, an empty string is placed i.e. <View> {" "} /View> You should have to remove this String.

Upvotes: 3

Related Questions