为什么会出现解析错误
Parsing error: Unexpected token Props (null)对于这个react原生应用程序示例代码?我用的是standardJS林特。
import React, { Component } from 'react';
import {
Text,
View
} from 'react-native';
type Props = {}; // <-- What is wrong with that?
export default class App extends Component<Props> {
render() {
return (
<View>
<Text>
Welcome to React Native!
</Text>
</View>
);
}
}发布于 2018-04-19 05:25:54
除非你有一个很好的理由想要发送道具,否则你不需要它。只需删除它并保留'Component {}‘
此外,您可能需要使用静态而不是类型。如果你从另一个地方复制,他们可能正在使用babel和另一个模块。这是我第一次看到有人写这篇文章。
https://stackoverflow.com/questions/49909131
复制相似问题