Design comparison
Solution retrospective
Hi all, I'm currently a student learning coding. Are there any areas of improvements that I can work on? Feedback is welcomed!
Community feedback
- @RajSanjelPosted over 2 years ago
There is a bug in your website. When user click on 1 and then submit it doesn't submit.
0@UygnisPosted over 2 years ago@RajSanjel Hi, thanks for noticing my mistake. I tried using if (active){} on submit button and for some reason, the first button didn't work. I've changed it to if(active !=='') and it works now. If you don't mind, do you perhaps know the reason why?
0@RajSanjelPosted over 2 years ago@Uygnis could you send full code? I kinda don't get what you mean to say. 😅😅
0@UygnisPosted over 2 years ago@RajSanjel Sure! const [submit, setSubmission] = useState(false); // before: <button type='button' className='btn btn-submit' onClick={() => { if(!active){ setSubmission(true); } }}>SUBMIT</button> // after: <button type='button' className='btn btn-submit' onClick={() => { if(active !==''){ setSubmission(true); } }}>SUBMIT</button>
0@RajSanjelPosted over 2 years ago@Uygnis using !active means if it was true then it changes to false and if it was false it becomes true(generally it makes the given value opposite) and !== means not equal value or not equal type means its gonna check if the active is equal to the value provided or not. If you want to learn more about logical operator and comparision click here You can also check this out
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin 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