Dropdown

mail@pastecode.io avatar
unknown
javascript
2 years ago
374 B
1
Indexable
Never
const sortTypes = ['Most relevant', 'Newest', 'Oldest'];
const [selected, setSelected] = useState(sortTypes[0]);

<Dropdown
    label={selected}
    open={open}
    onClick={handleOpen}
    setOpen={setOpen}>
    {sortTypes.map((type) => (
        <li
            key={type}
            onClick={() => setSelected(type)}>
            {type}
        </li>
    ))}
</Dropdown>