Quantcast
Viewing latest article 1
Browse Latest Browse All 3

Answer by Kishan Jaiswal for React utility function to bind this keyword

    import { handleKeyPress } from "../util/index"
    class Input extends Component {
      constructor(props) {
        super(props)
        this.state = {
          isOpen: false
        }
      }

      render() {
        return <input onKeyPress={(e) => handleKeyPress(e)} />
      }
    }

remove this from calling function and remove bind function line


Viewing latest article 1
Browse Latest Browse All 3

Trending Articles