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

166
Views
Menú desplegable de reacción de la interfaz de usuario semántica: ¿Puede establecer dinámicamente el valor?

Estoy usando un menú desplegable de semantic-ui-react . El menú desplegable de la interfaz de usuario semántica está en mi componente Artists y ese componente se está utilizando como su componente principal, App .

En este momento, el menú desplegable funciona bien, si selecciona un nombre (artista) del menú desplegable, se llama a la función handleArtistSelection con el nombre de ese artista pasado. La mayor parte del código está debajo.

Pero, ¿hay otra forma de establecer el valor del menú desplegable? Por ejemplo en jquery puedes usar:

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

Componente de la aplicación

 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> ) }

Componente de artistas:

 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!