Using Next.js with Expo will enable you to server side render the web part of your Expo app. This demo shows you how to setup your universal application to use use advanced universal modules from the Expo SDK like Camera, Gestures, Permissions, etc... with the Next.js tool-chain!
π¨ SSR is an experimental feature with Expo so modules might not be fully optimized for Next.js. If you find bugs please report them on the Expo repo or expo-cli repo with the
[nextjs]
tag in the title.
For the most updated guide you should refer to the Expo docs: Using Next.js. Here are the latest docs on master.
In this approach you would be using SSR for web in your universal project. This is the recommended path because it gives you full access to the features of Expo and Next.js.
- Bootstrap your project with Expo
- Install the CLI:
npm i -g expo-cli
- Create a project:
expo init --template blank
cd
into the project
- Install the CLI:
- Install the adapter:
- yarn:
yarn add @expo/next-adapter
- npm:
npm i --save @expo/next-adapter
- yarn:
- Add Next.js support:
yarn next-expo
- Always commit your changes first!
- You can optionally choose which customizations you want to do with
--customize or -c
- Force reload changes with
--force or -f
- Start the project with
yarn next dev
- Go to
http://localhost:3000/
to see your project!
- Go to
-
Starting web
- π«
expo start:web
- β
yarn next dev
- π«
-
Building web
- π«
expo build:web
- β
yarn next build
- π«