Faq Accordion using React JS

Solution retrospective
I have solved this challenge before using vanilla JS. This is my solution using React
However, there is a bug in my code. When the page is first loaded , and with the first click on any question, the question toggles correctly. But after that, I need to click twice on each question to toggle and I don't know why !!.
My code is not good for such simple functionality. I would apprecicate feedback on how to fix the bug and improve my code.
Thank.
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Mohammed Fakih's solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord