---
# System prepended metadata

title: how to define use and bind

---

# how to define use and bind

class TotalValue extends Component {
  constructor(props) {
    super(props);

    // Step 3. bind this
    this.showSum = this.showSum.bind(this);
  }

  // Step 1. function define
  showSum() {
    // total number
  }

  render () {
    return (
      <div>
        {/* { Step 2. function Use } */}
        {this.showSum()}
      </div>
    )
  }
}