skip to Main Content

This is my simple code and its giving me that error, can someone help me?

App.js

comp1.js

folders

error

2

Answers


  1. If you want to create functional component – you need to create it smth like this:

    import React from "react";
    import { View, Text } from "react-native";
    
    const TextComponent = () => {
      return (
        <Text>Hello</Text>
      );
    };
    
    export default TextComponent
    

    You should read about difference between function/class components/functional components.

    Start from here:
    https://reactnative.dev/docs/view

    Login or Signup to reply.
  2. You haven’t specified your function name, so
    change your comp1.js function likewise :

    const C1 = () => {
      return (
        <Text>Hello</Text>
      );
    };
    
    export default C1;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search