Brug af id-funktionen i React
Vi kan bruge vores funktion på følgende måde ved deklaration af et objektarray:
const prods = [
{id: id(), name: 'product1', cost: 100},
{id: id(), name: 'product2', cost: 200},
{id: id(), name: 'product3', cost: 300},
];
Lav et objektarray med brugere, og generer deres id ved hjælp af vores funktion.