a basic react component rendering a list items from an array in javascript

Below is an example of a basic React component that renders a list of items from an array:

import React from 'react';

const List = ({ items }) => {
  return (
    <ul>
      {items.map(item => <li key={item.id}>{item.name}</li>)}
    </ul>
  );
}

export default List;
179 chars
12 lines

The component takes a prop items, which is an array of objects with an id and name property. It uses the map method to iterate through each item in the array and return a list item with the name as its text content. The key prop is set to the id of each item for performance optimization. Finally, the list items are wrapped in an unordered list (<ul>) element.

gistlibby LogSnag