Reactjs, Super expression must either be null or a function

后端 未结 2 1759
夕颜
夕颜 2020-12-22 02:32

I use the React to write this demo. I use the Webpack to build this demo.When I start this demo, the error will show me.

The error:

Uncaught

2条回答
  •  隐瞒了意图╮
    2020-12-22 03:25

    try following:

            import React, {Component} from 'react';
            import ReactDOM from 'react-dom';
            class App extends React.Compoment {
              constructor(props){
                super(props);
                this.myTextInput = this.myTextInput.bind(this);
                this.handleClick = this.handleClick.bind(this);
              }
              handleClick(){
                if(this.myTextInput !=null) {
                  this.myTextInput.focus();
                }
              }
              render (){
                return (
                  
    this.myTextInput = ref} />
    ); } } ReactDOM.render(, document.getElementById('app'));

提交回复
热议问题