gatsbyjs image code example

Example 1: gatsby image

const path = require(`path`)

module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: path.join(__dirname, `src`, `images`),
      },
    },
    `gatsby-plugin-sharp`,
    `gatsby-transformer-sharp`,
  ],
}

Example 2: gatsby image

npm install --save gatsby-transformer-sharp gatsby-plugin-sharp

Example 3: gatsby plugin image

The new plugin gatsby-plugin-image

A faster and better way to use images in react!

Also, check out gatsby3.0!