[英]TypeError: undefined is not an object 'createElement' of undefined - React Native
我有一個LoginForm.js
組件
import { React, Component } from 'react';
import { Button, Card, CardSection } from './common';
class LoginForm extends Component {
render() {
return (
<Card>
<CardSection />
<CardSection />
<CardSection>
<Button>
Login
</Button>
</CardSection>
</Card>
);
}
}
export default LoginForm;
我試圖像這樣將其集成到我的App.js中
import React, { Component } from 'react';
import { View } from 'react-native';
import firebase from 'firebase';
import { Header } from './components/common';
import LoginForm from './components/LoginForm';
class App extends Component {
componentWillMount() {
firebase.initializeApp({
apiKey: '*********',
authDomain: 'rn-auth-a3fb5.firebaseapp.com',
databaseURL: 'https://rn-auth-a3fb5.firebaseio.com',
projectId: 'rn-auth-a3fb5',
storageBucket: 'rn-auth-a3fb5.appspot.com',
messagingSenderId: '34567890'
});
}
render() {
return (
<View>
<Header headerText='Authentication' />
<LoginForm />
</View>
);
}
}
export default App;
我一直出錯
TypeError:無法讀取未定義的屬性“ createElement”
此錯誤的位置是:RCTView(位於View.js:43)的RCTView(位於ViewApplication.js:32)的RCTView(位於View.js:43)的LoginForm(位於App.js:43) AppContainer中的View.js:43)(位於renderApplication.js:31)
我希望得到這樣的東西
人們將如何進一步調試呢?
您在LoginForm.js
React導入不正確。 React
應該是默認導入。
import React, { Component } from 'react';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.