I solved it by doing:
let clientId = 2;
this.props.history.push({
pathname: '/client',
search: "?" + new URLSearchParams({clientId: clientId}).toString()
})
or
this.props.history.push('/client?clientId=1')
I put the above code in a function and binded it in constructor so it has access to props and props.history in your case:
constructor(props){
super(props)
this.onSubmitClick = this.onSubmitClick.bind(this)
}
onSubmitClick(){
this.props.history.push('/client?clientId=1')
}
and
<form onSubmit={this.onSubmitClick}>
</form>
You might also need to wrap your component in a withRouter decorator eg. export default withRouter(Component);
Expected onSubmit listener to be a function, instead got type object/mebut also have the parameter showAge, so/me?showAge=true