index.ts257 chars18 lines
Explanation:
React
from the react
package along with defining the Props
interface for the component.List
component is defined as a functional component accepting the props
object.<ul>
) containing the list items (<li>
) generated by mapping through the array of items and rendering each one.<li>
element requires a key
attribute, so we use the index
of each item as a unique key.List
component is exported for use elsewhere in the application.gistlibby LogSnag