2
所以我正在關注一個關於React Native的課程,它似乎有點過時了。 只是試圖導入一個組件。元素類型無效期望一個字符串undefined
import React, { Component } from 'react';
import { AppRegistry, Text, View } from 'react-native';
import TaskList from './TaskList';
class AwesomeProject extends Component {
constructor(props, context) {
super(props, context);
this.state = {
todos:[
{
task:'Learn React Native'
},
],
};
}
render() {
return (
<TaskList />
);
}
}
AppRegistry.registerComponent('AwesomeProject',() => AwesomeProject);
TaskList.js
import React, { Component } from 'react';
const {
Text,
} = React;
class TaskList extends Component {
render() {
return (
<Text>Hi this is the TaskList!</Text>
);
}
}
export default TaskList;
我環顧四周,我沒有做錯什麼人在那裏
在'TaskList'嘗試做'從「反應,native''進口{}的文本,而不是'const的{文字} =陣營;' – Cherniv
解決了它,你想發佈你的修復,謝謝 – Burf2000
很酷,很高興它適合你 – Cherniv