How to Create an Expo Template for React Native Development

Author

Spencer Carli

Developer, cat dad, and devout pizza lover. Teaching at React Native School and building apps with Handlebar Labs.

Last Updated: May 19, 2021

I recently created a simple free Expo template to make building React Native tutorials easier and, hopefully, help the community out a bit.

In doing so I had to ask the question... how do I actually create an Expo template?

As with all things Expo related, it was simple.

How to Create An Expo Template

As I found out in my research (which consisted of looking at existing Expo templates) I found out that any Expo app can be turned into a template.

Note: You'll need to have the Expo CLI installed.

Then create a new project.

expo init TemplateApp

Next you'll need to actually create the starter/template app you want to use.

In my case I added some components, prettier, eslint, navigation, and project structure.

Publishing the Expo Template

First, make sure to create a good (or at least decent) README so people know how to use the template.

You'll then need to prepare it to be published on NPM.

In summary this means updating your package.json.

  • Set the name property to something unique (like @react-native-school/expo-template)
  • Remove private: true
  • Give it a description
  • Add some keywords
  • Add a homepage link
  • Add a repository link
  • Add a license
  • Set the author - give yourself some credit!

Run npm publish.

And you're set!

Using the Expo Template

Using the template is likewise very easy. Just init the project with the template you published to NPM.

expo init --template @react-native-school/expo-template
React Native School Logo

React Native School

Want to further level up as a React Native developer? Join React Native School! You'll get access to all of our classes and our private Slack community.