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

259
Views
On toggle every array is getting open in react js
export const MobileFAQ = ({ faqs = [], defaultOpen = false }) => {
  const { isOn: open, toggle } = useToggle(defaultOpen);
  const ToggleIcon = open ? MinusIcon24Gray : PlusIcon24Gray;
  return (
    <div className="p16">
      <h4 className="section-text-5 mb16">Frequently asked questions</h4>

      {faqs.map((u, index) => (
        <>
          <div className="faq-item" onClick={toggle}>
            <span className="c-black-3 text-medium">{u.question}</span>
            <div className="faq-toggle-icon-mobile"></div>
          </div>

          <Collapse in={open}>
            <div className="faq-answer c-black-3 text-4">{u.ans}</div>
          </Collapse>

          {index !== faqs.length - 1 && (
            <div
              style={{ height: 1, width: '100%', backgroundColor: '#e6e6e6' }}
              className="mt12 mb16"
            />
          )}
        </>
      ))}
    </div>
  );
};

I have created faq array which is showing question and answer on toggle but it get open every index which should be coming as index wise

about 4 years ago · Juan Pablo Isaza
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!