Play Game button

The Play Game button in the GameDetail component will simply be a Link component that points to the route that opens the React 360-generated index.html (implementation for this route on the server is discussed in the Playing the VR game section).

mern-vrgame/client/game/GameDetail.js:

<Link to={"/game/play?id=" + this.props.game._id} target='_self'>   <Button variant="raised" color="secondary">      Play Game   </Button></Link>

The route to the game view takes the game ID as a query parameter. We set target='_self' on the Link so React Router skips transitioning to the next state and lets the browser handle this link. What this will do is allow the browser to directly make the request at this route, and render the index.html file ...

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.