Created
June 17, 2019 00:55
-
-
Save abhishekjakhar/9b7e9148d6dcb4a2082bdabdfd90a0dc to your computer and use it in GitHub Desktop.
React Fragment (Description Component)(Keyed Fragment)
This file contains hidden or 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
import React from 'react'; | |
const teachers = [ | |
{ id: 1, name: 'Abhishek', subject: 'React' }, | |
{ id: 2, name: 'Aakash', subject: 'JavaScript' } | |
] | |
const Description = () => ( | |
<dl> | |
{ | |
teachers.map(teacher => | |
<React.Fragment key={teacher.id}> | |
<dt>{teacher.name}</dt> | |
<dd>{teahcer.subject}</dd> | |
</React.Fragment> | |
) | |
} | |
</dl> | |
); | |
export default Description; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment