1

I'm starting with react native and I find the next mistake, I'm a little disoriented.

From App.js I import the component Home.js, but I get the following error:

### ERROR #################

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s, undefined, You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

#### App.js #############

import React, { Component } from 'react';
import { StyleSheet, Text, View, TextInput, TouchableOpacity } from 'react-native';

import { Home } from './componentes/Home';

export default class App extends Component {

  render(){
    return(
      <View>
        <Home />
      </View>
  );
}

### ./componentes/Home.js ###########

import React, { Component } from 'react';
import { StyleSheet, Text, View, TextInput, TouchableOpacity } from 'react-native';

export default class Home extends Component{
    render() {
      return (
        <Text>Home</Text>
      );
    }
  }
2
  • This is the English StackOverflow, please only ask questions in English here. Commented Jan 3, 2020 at 13:25
  • his question is valid, jus he has posted in whatever labguage, maybe spanish. Commented Jan 3, 2020 at 13:31

1 Answer 1

1

Just in your App.js change your way of importing Home to ,

import  Home  from './componentes/Home';

AND NOT THE ONE BELOW

import { Home } from './componentes/Home';

hope it helps , feel free for doubts

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.