[React Native]Invariant Violation: Element type is invalid: expected a string( for built-in components) or a class/function..
1 min readJul 29, 2019
Here’s full description:
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.
How to resolve ?
- Adding
export default
- For example import using this code :
import ModelLoading from ‘../modals/ModelLoading’;
instead of this :
import { ModelLoading } from ‘../modals/ModelLoading’;
In my case instead of exporting like this:
export default App;
…I exported like following:
import ModelLoading from '../modals/ModelLoading';
It worked completely fine.
Hope it help ~.