Tips and tricks
React Native is great, but all great things have some minor flaws. Because you'll never know what type of error you might encounter, I've decided to create a list of the most common errors and fixes. Let's begin!
Import error
This error usually comes up whenever you've mixed default and named imports. Let's check out the error message:
Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: 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. Check the render method of 'App'.
As we can see, this error has been caused by a component being imported into the main App.js
file. Unfortunately, the error message does not tell you which component or line is breaking the app. To make sure this won't happen again, you'll have to double-check...