Created
May 17, 2021 19:37
-
-
Save pflevy/111a3379246880858e5343ad509536ee to your computer and use it in GitHub Desktop.
React.Fragment example where keys are required by React.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MyComponent = (props) => { | |
return ( | |
<> | |
{props.entries.map((entry) => ( | |
<React.Fragment key={entry.id}> | |
<h2>{entry.header}</h2> | |
<h3>{entry.subheader}</h3> | |
</React.Fragment> | |
))} | |
</> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment