Reactjs 对我所说的作出反应';我在这里做错了

Reactjs 对我所说的作出反应';我在这里做错了,reactjs,react-native,Reactjs,React Native,我正在尝试实现一个功能组件。在这里,我做下面,但我得到了有关道具的错误。谁能帮帮我吗 import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; const TextField = () => { return ( <Text> {this.props.title} </Text> ) } export default Text

我正在尝试实现一个功能组件。在这里,我做下面,但我得到了有关道具的错误。谁能帮帮我吗

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

const TextField = () => {
    return (
        <Text> {this.props.title} </Text>
    )
}

export default TextField;

// APP Component
    import TextField from './Components/TextField'
    export default class App extends React.Component {
      render() {
        return (
          <View style={styles.container}>
          <TextField title= "Simple App"/>
          </View>
        );
      }
    }
从“React”导入React;
从“react native”导入{样式表、文本、视图};
常量文本字段=()=>{
返回(
{this.props.title}
)
}
导出默认文本字段;
//应用程序组件
从“./Components/TextField”导入TextField
导出默认类App扩展React.Component{
render(){
返回(
);
}
}

原因是
这一点。功能组件中未定义道具。他们接受道具作为辩论

更改您的
TextField
以获取参数
props
并使用
props.title

const TextField = (props) => {
    return (
        <Text> {props.title} </Text>
    )
}
const TextField=(道具)=>{
返回(
{props.title}
)
}

您在调试上花了多少时间?问起来容易,搜索起来难
const TextField=(props)=>{return({props.title})}
我们可以添加自定义的道具吗?