Now I'm doing 'dirty' split to get any id from the url. I'm not sure how to utilise react router, I did something like this
this.__isEdit = (this.props.history.location.pathname.indexOf('edit') > -1)
const pathnameArr = this.props.history.location.pathname.split('/')
this.__todoId = pathnameArr[pathnameArr.length - 2] //get second last arr
for one of my route
<Route exact path='/admin/ad/:id/edit' component={createTodoComponent} />
Anyway I can improve it the code?