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

106
Views
React Final Form - Double conditional Form

I have started to work on a form project using React final form, but I am struggling to do a two condition question.

Would anyone knows how to do a double conditional logic on React final form. From this example, the single conditional logic code is given :

const Condition = ({ when, is, children }) => ( <Field name={when} subscription={{ value: true }}>
{({ input: { value } }) => (value === is ? children : null)}  </Field>)

However, I don't know how to do a double conditional one that would require 2 different answers from two different questions in the form to be checked before displaying the conditional question.

Thank you :)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You could use useFormState from react-final-form to obtain current form state, so MultiCondition component could look like this:

const MultiCondition = ({ condition, children }) => {
  const { values = {} } = useFormState({ subscription: { values: true } });
  return condition(values) ? children : null;
};

than somewhere inside the form:

<MultiCondition condition={({ gift, firstName }) => gift && firstName === "Joe"}>
  <span>gets rendered when condition is satisfied</span>
</MultiCondition>
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!