score:0

instead of relying on the previous url, you can add a state object to the location descriptor when you are redirecting.

function redirectaftersignin() {
  const {
    nextpath,
    join = false
  } = this.props.location.query

  this.router.push({
    pathname: nextpath,
    state: { join }
  })
}

then in your other component, you will just need to check the location.state prop to determine the join value.

class mycomponent extends react.component {
  componentwillreceiveprops(nextprops) {
    if (nextprops.location.state.join) {
      // do something
    }
  }
}

Related Query

More Query from same tag