"Please, at least try it. You'll love it".
"I don't have to, I already know what I like"
"But you haven't tried it, you might like it if you try!"
"I already know, I don't like it".
I am the type that could probably eat the same thing nearly every day. I even order the same meal at restaurants once I find something I like, I am always hesitant to try something new. There are types of food that I know I like a lot. But guess what? I had to at least try something, to know that I liked it in the first place!
My Portfolio Problem
I was working on my Gatsby portfolio, and decided to run a google PageSpeed test, and see how my site performance was doing. My home page was getting a 90 on mobile, and an 86 on desktop. Now, me being a bit of a perfectionist, I wanted my site to perform better. My site didn't have much running on the home page, some text, and an image. So I checked the details of the PageSpeed Insights, and realized that it was the image causing the decrease in my ranking. I wanted a solution to make my site as optimized as possible.
The Gatsby-Image Solution
I had read the documentation of Gatsby and knew they had a solution that was great for high quality photos. Gatsby-Image essentially loads images "up". Starting with a lower "fuzzy" quality photo served to the client so that it can load the page must faster, while a higher quality photo would be served after. This was exactly what I needed, it was a perfect solution for my situation. So why was I so hesitant to use it?
GraphQL - "I don't like it"
I knew that in order to use Gatsby-Image, I was going to have to use GraphQL. I had seen GraphQL used in a online course I had taken, and I was convinced I didn't like it. The whole idea of GraphQL seemed very confusing and it even had its own syntax. I had avoided using it thus far in my projects, and I hadn't stopped to consider why I was avoiding it, I just knew I didn't like it.
I was determined however to make my site better, so I was forced to learn GraphQL. I started reading the docs, I coded, and tested. At first, I still didn't like it and in fact, I may of liked it less than in the beginning. It still didn't make sense to me, why was my GraphQL query not working in my component? How is it passing the data to my component at all?
After a few tutorials and docs, I realized several things I was doing wrong. I moved my query outside of my component and into a page, so that Gatsby would run it in its lifecycle, and passed my props correctly into my component. Everything worked, and it boosted my PageSpeed in the top 90's when I was done.
Understanding before Judgement
Oftentimes, it is our lack of understanding with a coding concept that causes us to have a kneejerk reaction of "I don't like it".
I finally understood what was happening in the code. How Gatsby was running the query and GraphQL returning the query as props, and how accessing the data is as easy as accessing data in an nested object. Once I realized all of this, I actually liked GraphQL.
I realized I was so quick to judge it, all because I didn't fully understand it. This is what we as humans are prone to do right? We often make a judgement before having understanding.
If our first impulse is to avoid using a tool, maybe we don't have a good understanding of the tool itself. We need to really try to understand a coding concept first, and even try it, so that we can make a more educated decision on whether we like it or not.
Use a tool in your next coding project that you don't like, or makes you uncomfortable. You may find after trying it, it becomes a new tool that you like and use in future projects.
Top comments (2)
Absolutely agree. This is what is called "comfort zone". Our brain is wired to reject everything outside of our comfort zone at first. And that's a great example you made.
After 1 year working with React, someone told me to "learn Redux" because you "can't really create web-apps without it". I never liked this kind of sentences with no proof behind. Still, I tried to learn it and I didn't like it. Actually, I was like "I can do everything with React with much less code, much less complexity and much fewer restrictions".
After 4 years I haven't changed my idea. After that Redux course, I never used redux in a project because I don't like it and it doesn't make sense to me (like jquery and lodash).
Still, I really liked one of the concepts of Redux and now I use it in all my React projects and I think it makes my code better.
Moral of the story: trying something new always has a positive outcome. It could be a new tool, a new concept or it could just open our minds a little.
Great article, bye!
Right! I think it’s always great to push ourselves, and get outside of our comfort zones. Not only in coding, but in our personal lives as well!