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

265
Vistas
How can I pass an object in the value of on option tag in Formik?

How can I pass an object in the value of on option tag in Formik?

I am trying to send a data object from a select option tag in Formik.

I get access to a player object through props that looks like this:

{
  id:'123'
  name:'Life'
}

My option tag looks like this:

export const GameOption = ({ game }) => {
  return (
    <option value={(game.id, game.name)}>
       {game.name}
    </option>
  )
}

And my Formik schema look like this:

import * as Yup from 'yup'

// Formik initial values
const RecordGameValues = {
  gamePlayed: [],
}

// Yup validation
const RecordGameSchema = Yup.object().shape({
  gamePlayed: Yup.array().min(1),
})

export { RecordGameValues, RecordGameSchema }

I want to pass in both, the game.id and game.name from the game prop through the Formik form. However, when I supply both (game.id, game.name), I get an error of Warning: The `value` prop supplied to <select> must be a scalar value if `multiple` is false.

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