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

77
Vistas
React.FC call with multiple parameter

I am trying to call the function with three parameter but its not working.

Here is the React.FC:

const FormStructure: React.FC<{ record: ModelClass, question: Array<ModelClass>, dropdownItems: Array<ModelTypeClass> }> = ({
    record, question, dropdownItems,
}) => {
...
}

and this is the function call:

return (
   <Modal
      visible={this.state.modalVisible}
      onCancel={() => this.setState({ modalVisible: false })}
   >
      {FormStructure(record, this.state.question, this.state.dropdownItems)}
   </Modal>
)

Following Error Message: "Expected 1-2 arguments, but got 3"

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Since FormStructure is a component, you shouldn't be calling it as a function. You should instead create a JSX element:

<Modal
  visible={this.state.modalVisible}
  onCancel={() => this.setState({ modalVisible: false })}
>
  <FormStructure 
    record={record}
    question={this.state.question}
    dropdownItems={this.state.dropdownItems}
  </FormStructure>
</Modal>

If, hypothetically, you wanted to call it as a function (again, you shouldn't do that since this is a component), the way to conform to the type definition is to pass in an object with three properties:

FormStructure({ 
  record: record,
  question: this.state.question,
  dropdownItems: this.state.dropdownItems,
});
about 4 years ago · Santiago Trujillo Denunciar

0

FormStructure is a Functional Component, so you better render it with the following syntax (JSX):

return (
  <Modal
    visible={this.state.modalVisible}
    onCancel={() => this.setState({ modalVisible: false })}
  >
    <FormStructure record={record} question={this.state.question} dropdownItems={this.state.dropdownItems)} />
  </Modal>
)
about 4 years ago · Santiago Trujillo 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