I don't like it
Tags: graphql, gatsby, beginners, learnsomethingnew
Published: 2020-12-03 18:20:36

> "*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***".

<br />
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](https://developers.google.com/speed/pagespeed/insights/) 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](https://www.gatsbyjs.com/plugins/gatsby-image/) 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.