Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
Showing selected item in react js using bootstrap v5.0

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]
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!