Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

78
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda