I got a random generated search hash router and I don't know how pass state to it. Here is what I tried so far.
<Link to={`/mahjongGame?roomCode=${randomCodeGenerator(4)}`} state={{ dataForm:data }}><button className="game-button yellow" >Confirm2</button></Link>
This is the route path.
<Route path='/mahjongGame' exact component={MahjongGame} />
This is the result of console.log(props.location)
in the routed page
{pathname: '/mahjongGame', search: '?roomCode=wYTj', hash: '', state: undefined, key: 'ab5in5'}