React 绑定点击事件和change事件

 onSubmit:为点击事件,改变this事件

onChange:为关联触发事件

 

import React, { Component } from 'react'

class PostFrom extends Component {
    constructor(props) {
        super(props)
        this.state = {
            title: '',
            body: ''
        };
        // this.onChange = this.onChange.bind(this)
    }
    onSubmit(e){
        console.log(e)
    }
    onChange(e){
        console.log(e)

    }
    render() {
        return (
            

添加内容




) } } export default PostFrom;

 

你可能感兴趣的:(React)