📜  反应原生类组件构造函数 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:36.547000             🧑  作者: Mango

代码示例1
import React from 'react';  
import { View, TextInput } from "react-native";

class App extends React.Component {  
  constructor(props){  
    super(props);  
    this.state = {  
         name: "" 
      }  
    this.handleChange = this.handleChange.bind(this);  
  }
  handleChange(text){
    this.setState({ name: text })
    console.log(this.props);  
  }  
  render() {  
    return (  
    
      this.handleChange(text)}
      />
      
  }  
}  
export default App;