Skip to content

Instantly share code, notes, and snippets.

@richleach
Last active April 16, 2020 03:01
Show Gist options
  • Save richleach/83b35ddb7ed1d11dfbce5b7c45c24650 to your computer and use it in GitHub Desktop.
Save richleach/83b35ddb7ed1d11dfbce5b7c45c24650 to your computer and use it in GitHub Desktop.
REACT: Double ampersand if statement used in JSX output
//Read 'if the value in institutions is true, then execute the following .map() code'. I think it's an ES6 thing....
{ institutions &&
institutions.map((institutions) => (
<tr key={institutions.organization}>
<td width="15%">
{institutions.pctHeld.fmt}
</td>
<td width="60%">
{institutions.organization}
</td>
<td width="25%" align="right">
{institutions.position.fmt}
</td>
</tr>
))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment