0
我得到這個錯誤,不知道問題出在哪裏? 我想給header.js導入index.js陣營母語:元素類型是無效的預期字符串,但有反對
我index.js是:
//for ios application PLACE CODE HERE::::
//Import a library to help create a component
import React from 'react';
import { Text , AppRegistry } from 'react-native';
import Header from './src/components/header';
//Create a component
const App =() => {
return (
<Header/>
);
};
//Render it to the device
AppRegistry.registerComponent('yoyo',() => App);
而且header.js:
import React from 'react';
import { Text } from 'react-native';
const Header =() => {
return <Text>Albums!</Text>;
};
export default Header;
誰能幫我什麼是我錯了嗎?
我的index.js文件在src中? –
嘗試 '從'react-native'導入React,{Text,AppRegistry};' –
@Shubham仍然不能正常工作......如果我通過類導出它,那麼所有工作都正常......但不是這樣的......我不知道爲什麼 – Sam