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

211
Views
alguien me puede decir porque me aparece este error?

El error :

 React Hook "useState" is called in function "createFlight" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter react- hooks/rules-of-hooks

Mi código:

 import React, {Component} from 'react'; import { useState } from 'react' function createFlight(){ const [flight, setflight] = useState({flightNumber: "", departureTime: "", arrivalTime: "", departureDate: "", arrivalDate: "", cabin: "", economySeatsAvailable: "", businessSeatsAvailable: "", airport: "", from: "", to: "" }); } export default createFlight;
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Cambie el nombre de su componente para que comience con mayúscula (como indica el error).

 function CreateFlight(){

Si, en cambio, se supone que es un enlace personalizado, debe nombrarlo anteponiendo el use en el nombre. Como useCreateFlight

about 4 years ago · Juan Pablo Isaza Report

0

Los ganchos de React solo se pueden llamar en componentes de React u otros ganchos de React.

Los componentes de React tienen que estar en mayúsculas, así

 function CreateFlight(){ const [flight, setflight] = useState(); }

Luego se pueden representar así.

 <CreateFlight />

Los ganchos de reacción son funciones que vinculan el comportamiento a un componente. Tienen que llamarse "usar..." como "usarVuelo" o algo así.

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!