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

165
Vistas
is not assignable to parameter of type [React]

I have problem in react I wrote enum type

enum.ts

export enum DivingType {
  FreeDiving = "FreeDiving",
  ScubaDiving = "ScubaDiving",
}

and my home screen has graphql hooks

home.tsx

import { DivingType } from "..."

export const Home = () => {
  const [divingType, setDivingType] = useState<DivingType>(DivingType.FreeDiving)
  const [pageNumber, setPageNumber] = useState(1)

  useMatchingList(divingType, pageNumber)
  
  // --------------------[ Return ]--------------------
  return ...

useMatchingList.tsx

interface IUseMatchingListProps {
  divingType: DivingType
  pageNumber: number
}
export const useMatchingList: React.FC<IUseMatchingListProps> = ({
  divingType,
 ,
}) => {...}

and I have

Argument of type 'import("...").DivingType' is not assignable to parameter of type 'PropsWithChildren<IUseMatchingListProps>'

useMatchingList(divingType, pageNumber)
       |            ^

what is the matter ? please help me !

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

0

The FC in React.FC means "Functional Component". And a hook is not a component. A custom hook is just a function that calls other hooks. So it takes arguments just like any function would.

That means your hooks should look more like this:

export const useMatchingList = (divingType: DivingType, pageNumber: number) => {
  // my hook implementation
}

Working typesafe example

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