I felt like revisiting this bit of code from a few years ago, since it still gets a bit of traffic. You can view the old post at this link. Here’s the new code using React Hooks, scroll below for a demo: import React, { useState, useRef, useEffect } from "react"; function generateItems(numberOfItems) { return [...Array(numberOfItems).keys()].map((i) => { const num = i + 1; return { label: `Item ${num}`, id: `value-${num}` }; }); } export const ListComponent = () => { const listEl...