I want to push some text to url route in onChange method of an input like this :
function Header(props) {
return (
<div>
<input type="radio" onChange={ (e)=> props.history.push(`/${e.target.value}`) } >
</div>
)
But it throws multiple errors and crashes :
TypeError: Cannot read property 'push' of undefined
How can use history.push properly or how can I push some text to route url manually from anywhere in react ?