我有一个 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(在View.js:43)中的应用程序(在renderApplication.js:32中)在RCTView中的RCTView(在View.js:43中)( at View.js:43)在AppContainer中(在renderApplication.js:31)
我希望得到这样的东西
问题
How would one go about and debug this further ?
我现在对任何建议持开放态度 .
任何提示/建议/帮助将非常感谢!
1 回答
您在
LoginForm.js
中的React导入不正确 .React
应该是默认导入 .