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

81
Views
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 answers
Answer question

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 Report

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 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!