Skip to content
Advertisement

React Native Component Exception – Element Type is invalid: expected string…got undefined

I recently added a component to my project and this error is coming up for some reason. I know it’s being exported correctly from the component and imported by App.js correctly. (Exporting as default and importing without {}).

It’s also strange that when I change the export of App from exporting in the function declaration to exporting from below with the line “export default App;” the error changes. Normally it tells me “Check the render method of ‘ListingEditScreen’.” at the bottom of the error. But when I export with the line below the App function declaration, it says, “Check the render method of ‘ExpoRoot’.”

I am using Expo in this project, but I’m unable to find the ExpoRoot component in the Expo folder.

Here is my component:

JavaScript

And here is my current App.js:

JavaScript

Here’s a screenshot of the error on iOS simulator:

Error on iOS Simulator

Any help is greatly greatly appreciated! Thanks.

Advertisement

Answer

This error means that you are rendering a component that is undefined. This would throw the same error:

JavaScript

My guess would be that one of these components is not correctly named or not correctly exported from the forms file:

JavaScript

For example, if SubmitButton was actually Button, then you would see this error.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement