Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
React Fragment (Description Component)(Keyed Fragment)
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