Gatsby and MDX make a great pairing. Here's how to set up a new project with gatsby-mdx to write pages and other content using MDX.
Instructor: First we'll initialize a new Gatsby project using the default starter. Then we'll install gatsby-mdx and its dependencies, mdx-js/mdx and mdx-js/react. With mdx installed, we'll open our project. We need to modify the gatsbyconfig.js file to add the Gatsby mdx plug-in. Now we can run our project.
Once we've run our project, we can take the localhost URL and put it into our browser. Finally, we'll create a new page using an mdx to show that gatsby-mdx and mdx.js are working. Gatsby-mdx includes default support for source pages if we include a file with a .mdx extension. Now the site is rebuilt, we'll go to page 3. This is our mdx file.
You must be a Pro Member to view code
Access all courses and lessons, track your progress, gain confidence and expertise.