Let’s look at today’s fun topic.
Bashing my head on a wall until something works!
̷W̷h̷e̷n̷ ̷I̷ ̷w̷a̷s̷ ̷y̷o̷u̷n̷g̷
̶O̶n̶c̶e̶ ̶u̶p̶o̶n̶ ̶a̶ ̶t̶i̶m̶e̶
Yesterday, I solved a problem I had since some time. I’ve been doing freecodecamp for sometime now (for both confidence building and skill gain), and I was doing the frontend certification track (We’ll do backend at a later date).
To get the certification, you have to create certain projects. One of them was a JS calculator. Now, far be it from me to be stumped by a calculator (I loved my compiler class, and in python It’d be a breeze) but we’re in JS, and I was using react.
Now…… the problem was as follows (I’m not adding any code, if only due to my fatigue and general lack of interest currently).
I had a parent “calculator” element that maintained the state of the calculator, and I was passing a function that changed its state to a child component’s onClick parameter through props. The problem was that the onClick was being fired the first time it rendered.
So I went googling, and after some time, I found a solution. Apparently, the person was firing the function instead of passing it as a parameter to props. Alright, I said and went and I checked. Nope, not the solution.
Then someone else mentioned something about requiring lambda (anonymous for you who no speak math) functions for passing functions with parameters. I converted all my functions to lambda functions and off I went to test my solution. No luck.
And then I tried various combinations of whatever for solving the problem, considering that I had exhausted all my solutions found on the web. (No, I didn’t only try 2 solutions. Yes, I tried a doing it locally).
Until I switched browsers. And the problem stopped. When I opened my code in Vivaldi, I didn’t have this problem (If you’re wondering, Vivaldi is Chromium based).
After a lot of time, the only thing I could do was stare at my laptop with my jaw on the floor. (Whining aside, I’ve been using Firefox since years, so the idea of another browser wasn’t as apparent as you might think).
Anyway, I switched to Vivaldi, finished the calculator, learnt a lot, and moved on with life. Cuz that’s how problems are solved.
Note: I have a secret feeling that this a some sort of Google conspiracy to prevent adoption of Firefox.
Another Note: On the topic of God hates me, I couldn’t log into an instagram account today. I’m becoming old. Also, I screwed up my Linux installation today. That’s tomorrow’s story.