I am using Bootstrap v5.0 and not able to display selected from drop-down like if I click on Action it should show Action instead of Dropdown Link text. Any Idea how to do this in React Js using these codes. Thanks in advance.
Dropdown link<ul class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
[Bootsrap v5.0 Image][1]Firstly create a State in React.js.
const [selectedState, setSelectedState] = useState("")
You can use with backtick.
className=`dropdown-item-${selectedState}`
And handle with onClick event.
onClick={setSelectedState("selected")}
These codes makes selected each items. İf your links limited, you can give an id to each item and you can use array which keeps your selected item id's in your state.