react-native - “类型错误:超级表达式必须为空或函数”在本机反应中
问题描述
我正在使用 reactjs。我尝试制作登录布局。这是登录类:
import React, {Components} from 'react';
import {StyleSheet, View, Image} from 'react-native';
import LoginButton from '../components/LoginButton';
export default class Login extends Components {
constructor(props) {
super(props)
}
render() {
return (
<View style={styles.container}>
<LoginButton
placeholder={"Login"}
style={styles.LoginButton}
/>
</View>
)
}
..........
这是组件中的 LoginButton:
import React from 'react';
import {StyleSheet, TouchableOpacity, Text} from 'react-native';
export default class LoginButton extends React.Components{
constructor(props) {
super(props)
}
render() {
const {placeholder} = this.props
return (
<TouchableOpacity style={[this.props.style, styles.container]}>
<Text style={styles.caption}
placeholder = {placeholder}
/>
</TouchableOpacity>
)
}
}`........`
当我运行这段代码时,React Native 给出错误“typeerror: super expression must be null or a function”。我如何解决它 ?
解决方案
推荐阅读
- angular - Angular 和 Express 服务器通信问题
- node.js - 从用户自己的电子邮件 ID 发送邮件
- javascript - 书签链接应打开面板
- ruby-on-rails - 如何从数组中的哈希中获取值?
- ldap - 使用 DSML 格式同步 LDAP 服务器
- google-cloud-platform - 如何在谷歌云上排除一些日志级别的严重性?
- javascript - 如何简化表达式“data && data.pwd && data.pwd.length”?
- reactjs - 如何使用 nginx 处理来自同一个 repo 的两个不同的 react 构建?
- azure-devops - 如何在 DevOps Server 2020 中为现有项目更改流程模板
- vbscript - 如何在 ASP Classic 的 IF 语句中正确使用 LIKE?