Intermediate Gatsby with Gatsby Themes Gatsby Advanced Features Overview
This course has been updated! We now recommend you take the Intermediate Gatsby, v2 course.
Transcript from the "Gatsby Advanced Features Overview" Lesson
>> Jason Lengstorf: Beyond just the surface level building static sites, Gatsby has tons of advanced features. So one of the things that we're gonna talk about today is theming and theme composition. You can write up bundled functionality and styles and plugins and configuration for Gatsby, put that into a theme and then install that into a site as if it was a plugin, and you'll get all that functionality.
[00:00:23] Then you can install another theme next to that theme, and they just work with each other. They're not competing, they're not gonna, fight over things. That does require building your themes well, but we're gonna do that today, so don't you worry about that. You can also build custom data sources.
[00:00:40] You can get data from anywhere, if you've got an in house API, you can build a Gatsby source plugin that will pull that in and make it part of the GraphQL API. We're not gonna build a custom data source but we are going to do Schema customization. So that covers most of the basics of sourcing data.
[00:01:03] We're gonna combine build time and run time data so you can get a lot of the data, anything that doesn't change frequently. Put it together at build time, so that the site has that available and will work offline and loads very quickly. And then things that change frequently like if you've got inventory, or if you were running something like a stock app that needed to change prices every couple of seconds.
[00:01:23] You wouldn't be able to rebuild your site every couple of seconds. So you can get that client side and just update and you can do that with any pattern that you want skeleton patterns, spinners, whatever. Schema customization and custom data types allows you to overcome a couple problems.
[00:01:38] One is if the data is empty, like if you're using the file system and there are no files, Gatsby would say you're missing this field. Because there was no data to make that field exist. By creating custom data types we can avoid those errors. So we actually get empty sets back and you can do things like.
[00:01:56] In advanced cases, you could say I wanna have a page. And my page could come from Markdown. Or it could come from WordPress, or it could come from Contentful or any other number of places, but I just wanna query pages. So with schema customization and custom data types, you can actually pull data from all of those sources and put them into one bucket.
[00:02:18] We're not gonna get into that today. But we are gonna get into schema customization for a single source. And really the the underlying message here is that anything that React can do, Gatsby can most likely handle. Gatsby is, at the end of the day, a nice package for serving React apps, which means that React apps are just React apps you can do almost all of the same things.
[00:02:41] There are very few restrictions and almost all of those have escape hatches and controls and we'll look at some of that works today.