Gatsby Training
  • About this training
  • Fundamentals
    • React
    • Gatsby
    • GraphQL
    • JAMStack
    • JSX
    • Webpack
  • Getting Started
    • Build your first Gatsby site
    • Project structure
    • Component structure
  • Components
    • About Components
    • Eyebrow
    • Button
    • Heading
    • Working with CSS
    • Movie Card
  • Gatsby Core Components
    • Gatsby Link
    • Gatsby Image
  • Data and GraphQL
    • Data sources
    • Connecting a data source
    • Using the GraphQL playground
  • CreatePages
    • createPages Function
    • Create a template
  • Resources
    • Gatsby and React Resources
    • Other resources
Powered by GitBook
On this page

Was this helpful?

  1. Getting Started

Component structure

PreviousProject structureNextAbout Components

Last updated 4 years ago

Was this helpful?

  • All of the components created in this training will be housed under the src/components directory. Each will have it’s own index.js and styles.module.scss file.

  • The index.js files for the components will be where we use for the markup as well any javascript we may need.

  • In the styles.module.scss file will be all of our unique styles for each component.

A typical component structure looks like this:

gatsby
├── .cache
├── node_modules
├── public
└── src
    ├── components
    │   └── Container
    │       ├── index.js
    │       ├── styles.module.scss
    ├── global
    ├── pages
    ├── templates

Read more about Components in React/Gatsby:

JSX
https://www.gatsbyjs.org/docs/building-with-components/