- Forums
- react
- React Onclick Nothing Happens, This Is Why And What You Need To Change
if you are calling a function when onlcick is evoke, and its not doing anything, this is how you fix it. [5187], Last Updated: Mon Jun 24, 2024
cathy
Mon Aug 21, 2023
0 Comments
263 Visits
Onclick is not calling a function? This is how you fix it.
This is what I had originally:
onClick={submitAnswer(task)}
This is how you need to change it.
onClick={()=>{submitAnswer(task)}}
Hope that helps.