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

178
Views
Múltiples etiquetas predeterminadas con menú desplegable de reacción de IU semántica

Estoy usando el menú desplegable de reacción semántica y estoy tratando de obtenerlo, por lo que las opciones ya están en el menú desplegable como etiquetas múltiples, pero parece que no puedo agregarlas como valores predeterminados, entonces quiero poder agregar más que creo que puedo ya lo hice con este ejemplo, pero tengo problemas principalmente con múltiples etiquetas múltiples predeterminadas, ¿hay alguien que pueda ayudar?

 import React, { Component } from 'react' import { Dropdown } from 'semantic-ui-react' const options = [ { key: 'English', text: 'English', value: 'English' }, { key: 'French', text: 'French', value: 'French' }, { key: 'Spanish', text: 'Spanish', value: 'Spanish' }, { key: 'German', text: 'German', value: 'German' }, { key: 'Chinese', text: 'Chinese', value: 'Chinese' }, ] class DropdownExampleAllowAdditions extends Component { state = { options } handleAddition = (e, { value }) => { console.log('assinf') this.setState((prevState) => ({ options: [{ text: value, value }, ...prevState.options], })) } handleChange = (e, { value }) =>{ console.log(value) return this.setState({ currentValues: value })} render() { const { currentValues } = this.state return ( <Dropdown options={this.state.options} placeholder='Choose Languages' search={(props)=>(props)} defaultSelectedLabel={ options} selection fluid multiple allowAdditions value={currentValues} onAddItem={this.handleAddition} onChange={this.handleChange} /> ) } } export default DropdownExampleAllowAdditions

Sigo obteniendo este valor cuando intento agregar algo a la etiqueta predeterminada

 Warning: Failed prop type: Invalid prop `defaultSelectedLabel` supplied to `Dropdown`, expected one of type [number, string].
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Para que esto funcione, su etiqueta seleccionada por defaultSelectedLabel debe ser del tipo número o cadena. Entonces, en primer lugar, no debe enviar una matriz allí. En segundo lugar, creo que para lo que quieres se hacen props de defaultValue . Su definición en la documentación se declara como: "Valor inicial o matriz de valores si es múltiple". Si marca mi caja de códigos , verá que funciona allí.

 defaultValue={["English", "French"]} // is what I did
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!