Last active
March 30, 2020 17:03
-
-
Save akexorcist/6d8b034b33a60522543b89d6065ac526 to your computer and use it in GitHub Desktop.
Code Snippet for https://blog.nextzy.me/เมื่อเขียน-react-แต่ดันไม่รู้เรื่อง-method-binding-ใน-react-component-6a498f3f646f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react' | |
| ... | |
| class UserCard extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| name: 'Akexorcist' | |
| } | |
| this.onButtonClick = this.onButtonClick.bind(this); | |
| } | |
| onButtonClick() { | |
| ... | |
| } | |
| ... | |
| } | |
| export default UserCard |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment