Intermediate
A generic List<T>
The List component takes unknown items, so App can't read p.id or p.name in its callbacks. Make ListProps and List generic over T so getKey and renderItem receive the same type as items.
The checks use the component name List, the type Product, the array products and the container #shop.
What Check tests
- Your code has no type errors
- A List of numbers works with number methods
- A List of numbers rejects string methods
- A List of products rejects a property that doesn't exist
- The page shows three items, the first "Pen: 12"
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.