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

134
Views
Cómo probar el componente de reacción con setState en la biblioteca de prueba de reacción con Typescript

Tengo dos componentes en typeciprt. El componente principal crea el estado y pasa el estado y setState al componente secundario y el componente secundario recibe este setState.

padre.tsx

 function TestParent():JSX.Element { const [testResult, setResult] = useState<IResult | null>(null) return ( <TestChild setResult={setResult}/> ) }

niño.tsx

 interface IProps { setResult: Dispatch<SetStateAction<IResult | null>> } function TestChild(props: IProps): JSX.Element { ... }

Cuando pruebo child.tsx en child.test.tsx, dice setResult is missing :

 test('render component correctly', () => { render(<TestChild/> ... }

¿Cómo debo pasar el atributo setResult que falta para pasar la verificación de mecanografiado?

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!