Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

162
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda