I have a dictionary containing objects with cards. I would only like to display each card if the current user value is equal to the stored user value. IE, if the a given user created that card.
           <CardDeck>
            {this.props.homeTdps.map(function (tdp, key) {
              if ({currentUser.username} == {this.props.tdpDetail.created_by.username})
                return (
                  <Card.Link key={key} href={`/tdps/${tdp.id}/`} style={{ minWidth: '20rem', maxWidth: '20rem' }}>
                    <Card.Body>
                      <Card.Title>{tdp.part_name}</Card.Title>
                      <Card.Text>{tdp.description}</Card.Text>
                      <Button variant="primary">Download</Button>
                    </Card.Body>
                  </Card.Link>
                );
              // }
            })}
          </CardDeck>
I am having trouble however syntatically with the the third line:
if ({currentUser.username} == {this.props.tdpDetail.created_by.username})
My current error is as follows...

Any solution is appreciated,
Thanks!
EDIT:
I have also tried removing the curly brackets from the 3rd line:
if (currentUser.username == this.props.tdpDetail.created_by.username)
I then get the error "TypeError: Cannot read property 'props' of undefined".
However, when I print the two values within a header like so, they both print just fine (and the users are the same value).
<h3>{currentUser.username}</h3> 
<h3>{this.props.tdpDetail.created_by.username}</h3> 
 
     
    
{currentUser.username}
{this.props.tdpDetail.created_by.username}
– ehuff Mar 03 '21 at 05:58