I have a function which acts as a sort of focal point before calling my api.

I want to reduce the bloat a little by simplifying my if statements.

Currently I have a list of statements. 2 of which are shown below

```
    if (this.props.source === 1) {
      api.updateData01(id, data).then(res => {
        this.hideModal()
        this.props.updateData01()
        console.log('DATA UPDATED')
      })
    }
    if (this.props.source === 2) {
      api.updateData02(id, data).then(res => {
        this.hideModal()
        this.props.updateData02()
        console.log('DATA UPDATED')
      })
    }

```

I'd like to simplify it by bringing my if statements up and instead dynamically rename the functions. 

Something along the lines of

```
    if(this.props.source === 1){
      //rename updateData to updateData01
    }
    if(this.props.source === 2){
      //rename updateData to updateData02
    }

    api.updateData01(id, data).then(res => {
      this.hideModal()
      this.props.updateData01()
      console.log('DATA UPDATED')
    })

```

I've never had to rename a function before so am unsure how to begin.

I've attempted something like this but it obviously wasn't going to work.

```
   if(this.props.source === 1){
      const dataSource = 01
    }
   api.updateData + datasource + (.....

```