Edit and delete buttons

The GameDetail component will show the edit and delete options only if the currently signed-in user is also the maker of the game being rendered.

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

{auth.isAuthenticated().user     && auth.isAuthenticated().user._id == this.props.game.maker._id &&     (<div>       <Link to={"/game/edit/" + this.props.game._id}>          <Button variant="raised" color="primary"          className={classes.editbutton}>              Edit          </Button>       </Link>       <DeleteGame game={this.props.game}        removeGame={this.props.updateGames}/>    </div>)}

If the user ID of the signed-in user matches the maker ID in the game, the edit button linking to the edit form view and the DeleteGame component are shown in the view.

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.