Quantcast
Channel: React utility function to bind this keyword - Stack Overflow
Viewing all articles
Browse latest Browse all 3

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

$
0
0
    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 all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>