Console log props

Hello, i am struggling with finding the solution for this:

How to add a console.log statement to print out the props for my MyComponent page component?

import * as React from 'react'
import Layout from '../components/layout'

const MyComponent = () => {
  return (
    <Layout pageTitle="Super Cool Blog Posts">
      <p>My blog post contents will go here (eventually).</p>
    </Layout>
  )
}

export default MyComponent

First you need to add a props parameter and then you can add console.log(props) before the return statement.

There is a small detail in this. The file is using Gatsby’s File System Route API, {mdx.frontmatter__slug}.js in my case. It automatically adds some props into the page template component for each page.