0
votes

I'm a beginner of programming world, now I practice react-native by watching some tutorials on youtube.

This is the one that I'm watching: https://www.youtube.com/watch?v=gyiwFcrVRCM&list=WL&index=79&t=0s

This youtube creator even put his Source code: https://git.io/fjLxo Expo Snack: https://snack.expo.io/@react-ui-kit/p...

When I copy everything from the beginnig on watching, this error

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

Check the render method of 'App'.

occurs, and even in creator's expo, same problem happens on my mac.

My version is:

  • react-native-cli: 2.0.1
  • react-native: 0.61.5
  • and I use MacOS Catalina version 10.15.3

I'll really appreciate if somebody can solve this. Thank you for reading.

1

1 Answers

0
votes

This error arise when you are mixing named export with default export vice-versa

e.g
var user ="abc"
export const user //named export
export default user //default export

For e.g if you are importing like this

import MyDefaultComponent from "./MyDefaultExport"; //import default export module

replace it with

import {MyDefaultComponent} from "./MyDefaultExport"; //import named export module

checkout this article for detail understanding named-export-vs-default-export-in-es6