props.history.location code example

Example 1: difference between useHistory and props.history

//You can use useHistory() in any component, 
//but props.history only in components where the history is available in props

//When you use history.push, you do NOT have to specify the pathname. 

const queryString = new URLSearchParams(params).toString()
    history.push({
      search: "?" + queryString
    });

Example 2: props history

{
  key: 'ac3df4', // not with HashHistory!
  pathname: '/somewhere',
  search: '?some=search-string',
  hash: '#howdy',
  state: {
    [userDefined]: true
  }
}