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

159
Views
Semantic UI react dropdown: Can you dynamically set the value?

I'm using a dropdown from semantic-ui-react. The semantic-ui dropdown is in my Artists component and that component is being used its parent component, App.

Right now the dropdown is working fine, if you select a name (artist) from the dropdown then the handleArtistSelection function is called with that artist's name passed into it. Most of the code is below.

But is there another way to set the value of the dropdown? For example in jquery you can use:

$("#mydropdownlist").val("thevalue").change();

App Component

export default function App() {

     const handleArtistSelection = (artist) => {
        ...
     };

     const artistOptions = artistArray.map((artist) => { return {text: artist, value: artist} });

     return (
        <div className="App">
          <h1>Explore Music Award Show Winners</h1>
          <Artists options={artistOptions} onArtistChange={handleArtistSelection} placeholder={'Pick an artist'}/>
        </div>
     )

}

Artists Component:

import {Dropdown} from 'semantic-ui-react';

export default function Artists (props) {

    const handleOnChange = (e, data) => {
        props.onArtistChange(data.value);
    }

    return(
        <Dropdown placeholder={props.placeholder} search selection options={props.options} onChange={handleOnChange}/>
    )
}
about 4 years ago · Juan Pablo Isaza
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!