expected a component class, got [object Object] error
See original GitHub issueI got expected a component class got object error when I try to use loginPage component which I created.
here is index.ios.js
import React, {Component} from 'react';
import {
AppRegistry,
View
} from 'react-native';
import loginPage from './pages/loginPage'
class app extends Component {
render() {
return (
<View>
<loginPage/>
</View>
);
}
}
AppRegistry.registerComponent('app', () => app);
and here is the loginPage.js
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View
} from 'react-native';
export default class loginPage extends Component {
render() {
return (
<View>
<Text>
Welcome to React Native!
</Text>
</View>
);
}
}
RN version is 0.28.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
react native - expected a component class, got [object Object]
I got expected a component class got object error when I try to use loginPage component which I created. here is index.ios.js import...
Read more >(React) Element type is invalid, expected a string (for built in ...
To solve the error "Element type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got",...
Read more >Developers - Error in react-native: Expected a component class, got ...
Error in react-native: Expected a component class, got [object Object]
Read more >Error React createElement type is invalid expected a string for ...
Error React createElement type is invalid expected a string for built-in components or a class function for composite components but got object.
Read more >Invariant Violation: Element type is invalid: expected a string ...
[Solved]-Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function but got: object-Reactjs.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I made class names Capitalized and fixed. sorry.
This is the design of JSX so it’s a feature and not a bug, but it has tripped up experts in the past.