Check out example codes for "scss in gatsby". It will help you in understanding the concepts better.

Code Example 1

npm install gatsby-plugin-sass node-sass

# yarn
yarn add gatsby-plugin-sass node-sass

Learn ReactJs, React Native from akashmittal.com