Hello I am new to React JS. I am facing an issue regarding a variable value is not passing to a function.

Here is my code.

```js
class Main extends React.Component{

  state = {
    setType : ""
  }

  getType(getValue){
    let type = ''

    if(getValue === 'win'){
      type = 'win'
    }

    else if(getValue === 'lose'){
      type = 'lose'
    }

    else {
      type = ""
    }

    return type
  }

  componentDidMount(){
  let type = this.getType('win')
    this.setState({
      setType : type
    })

    if(this.props.match.path === '/win'){ 
        this.setState({
          setType : 'win'
        })
    }

    if(this.props.match.path === '/lose'){ 
        this.setState({
          setType : 'lose'
        })
    }
  }

  this.props.detail(this.state.setType)

}
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
```

If I write `this.props.detail(type)` instead of `this.props.detail(this.state.setType)` 

then it works fine. also I want to set `setType` value on url Hit. so that if matching url hits, then it's state value also changes and pass to `this.props.detail()`

Any help would be appreciated.