This is my code, everything is fine but when I click on the dropdown button, it shows a blank option like there is no option available to show in the dropdown menu.
import React, { useState } from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
import { DropdownButton, Dropdown } from "react-bootstrap";
import "bootstrap/dist/js/bootstrap.min.js";
const App=()=> {
const [cities, setCities] = useState(["agra", "delhi"])
return (
<div className="App">
<h2 className="text-center">Welcome to Nivaran</h2>
<DropdownButton id="dropdown-basic-button" title="Choose State">
{cities.map(city => {
<Dropdown.Item href="#">{city}</Dropdown.Item>
})}
</DropdownButton>
</div>
);
}
export default App;
Update:-
Answer- Actually, I am knew to react, I was unaware of the return statement that I was missing
{cities.map((city) => {
return <Dropdown.Item href="#">{city}</Dropdown.Item>;
})}