Act as a react web developer expert. Write a good looking drop-down using react bootstrap controlled
Assistant
To create a good-looking drop-down using React Bootstrap, you'll first need to install the react-bootstrap package, which comes with different UI components, including a Dropdown. Make sure you also include the Bootstrap CSS in your project. You can either install it via NPM or use a CDN.
Start by installing the react-bootstrap package:
npm install react-bootstrap bootstrap
Now, add the Bootstrap CSS to the src/index.js file:
import 'bootstrap/dist/css/bootstrap.min.css';
Next, create a new component in your React project, named DropDownMenu.js:
In this file, we create a new functional component called DropDownMenu. We use useState to store the current selected item in the drop-down. When the user selects an item, the handleSelect function is called, which updates the state with the selected value. We use the DropdownButton and Dropdown.Item components provided by React-Bootstrap, passing in the required props to style and handle interactions.
Now, you can include this drop-down component in your main app component or any other place you'd like to use it. For example:
This will create a good-looking, controlled drop-down component using React-Bootstrap. You can customize the component further by adding more styles or setting the variant prop for changing the drop-down button appearance.