In this post, we will be looking into how you can create pages programmatically from data (markdown files) in Gatsby. In order to create these pages dynamically from markdown, we will be looking into Gatsby’s Node createPages API
In this post, we will be looking into how you can create pages programmatically from data (markdown files) in Gatsby.
In order to create these pages dynamically from markdown, we will be looking into Gatsby’s Node createPages
API.
However, before we can do that, we need to install a couple of plugins that will source and transform markdown file in order for Gatsby to understand the markdown files path and its content, and be able to create those pages.
To create pages we would need to do the following 3 steps to make it happen dynamically.
By installing the following plugins
npm install --save gatsby-source-filesystem gatsby-transformer-remark
We will tell Gatsby about our content path with gatsby-source-filesystem
from the filesystem by passing an options object that contains a variable and file path.
In addition, we can transform those markdown files content to HTML and frontmatter metadata to frontmatter by using gatsby-transformer-remark
, which will transform those files into edges that contain node type of MarkdownRemark and each frontmatter fields into GraphQL fields that we can query later in our pages/components and map them at build time.
Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.
React-Query with GraphQL! You don't need to use Apollo or Relay for grabbing data from a GraphQL API. React-Query is agnostic and you can fetch data from any API. Learn how to do it in this video. I'm using react-query in combination with graphql-request and graphql-tag.
Increase Performance of React Applications Via Array JavaScript Methods. We will create a simple event management application in the react to add, update, and delete an event.
In the past few years, the buzz around functional programming has been growing, but it can be challenging to apply theoretical concepts to everyday work. How can we make the code we work on more functional? What advanced patterns can you use, and why should you do that? And what do React hooks have to do with all this? In this talk we’ll have a look at real-life examples and patterns you can use to make React apps more functional.
This week, I had to construct a date selector form in React that looks like this. As you can see, the user interface includes the surrounding month and date options in addition to the selected date. This means that I need to not only keep track of the current date, but I also need a way to conveniently figure out how many days are in the selected month.