Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Use gatsby-image's GraphQL fragments for blurred-up and traced SVG images


    Learn how to simplify the fields you include in your queries for image data by using GraphQL fragments. With this powerful abstraction, changing the fragment will change the behavior of your image, loading it as a minified blurred file or traced svg before loading the full size image when the rest of the content loads.



    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In




    Instructor: With an image where fields are queried in GraphQL, you can use GraphQL fragments provided by Gatsby as a shorthand, instead of writing out all the fields. In the query to get the image's data, instead of typing out each field individually, you can use fragments like GatsbyImageSharpFluid.

    If you check the data returned by the query, you'll see the same fields returned as before. Different fragments, like tracedSVG, will pull in other fields that will make the gatsby-image component behave in other ways, like adding a traced SVG placeholder, instead of a blurred image.