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

108
Vistas
useState how to set the initial long value

There is a very large state that I get from json, that consists of at least 50 lines.

When generating the page, it gives the error "there is no such value" if you do not set the value initially and assign the interface

const [dataPosibleValue, setDataPosibleValue]:[IStatPokemon,Dispatch<SetStateAction<IStatPokemon>>] = useState('')

Is it possible not to set the value at the beginning so that there is no error during generation?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can only set it, if you have it. If you have it you can set it by passing it into the function like so:

const [dataPosibleValue, setDataPosibleValue]:[IStatPokemon,Dispatch<SetStateAction>] 
  = useState('your initial long value')
about 4 years ago · Juan Pablo Isaza Denunciar
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