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

103
Views
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 answers
Answer question

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 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!