Skip to content

Snack Expo

Create Snack project

Creating a shareable and runnable code example should be quick and easy. Without Snack, if you have some code that you want to share then other developers that want to run it need to have a development environment set up, they need to download your project, trust that it is safe to run, install the dependencies, and then start the project. Tools like CodeSandbox, Blitz, and Replit solved this for web apps. You can create a project, write the code in your browser, and share it with a link.

Snack solves precisely that problem. It's an open-source platform for running React Native apps in the browser. You can write React Native code and run it directly in the browser or Expo Go.

One of the easiest way to a learn and test Expo based application is to install Expo client to the mobile phone and use Snack Expo in web browser. You can run apps in Android and iOS emulators in the same web page or in your own device.

Run Snack project

You can run your project in your own device, emulators or web view.

Select Web to see it like a "web page".

!Snack 01

It is easy to run and see your app in web view but you should also test it in emulators.

!Snack 02

Or scan Qr code to see it your own phone with Expo Go.

!Snack 03

Tip

You can add any library that works in a managed Expo project, like expo-camera or React Navigation. Add the import in the file that you want, and Snack will prompt you to install that dependency. You can also specify the exact version by adding it to your package.json file.

Test interactive Hello Expo project from here:

Debugging code in Snack

All logs from the web and mobile device previews are visible in the toolbar below the editor. To inspect the logs, click on the bottom toolbar and go to the "Logs" tab. While it's possible to view logs, it is not possible to connect a JavaScript debugger in Snack, you will need to download your project and run it with Expo CLI to do this. Press the download button in the header bar on the right to download the project to your machine.