Can you use your expo code to build a website?

I was wondering if it would be possible to re-use my expo app code to create a website for my app with the same functionality?

Hey @nickjuntilla ! Thanks for using Expo. I’m so excited you asked this question because its something thats very important to me.

The short answer is no, but in the future anything is possible. You can’t use react-native components on the web, yet.

But you can get close to the feeling of sharing a lot of code! a couple of weeks ago, I was able to build a NextJS website and Expo project where:

  • Utility methods were the same.
  • The redux store for state management was the same.
  • The constants were exactly the same.

Once NextJS and Expo use the same react dependency, I’ll provide you an example of how your web application and expo project can use the same package.json.

Hope that gets you hopeful! Sorry this might not have been the answer you were looking forward to, but the future is bright!

1 Like

It seems like the process would involve creating web version of the router and hardware API calls (like accelerometer) that use the same Expo API on top. So an Expo web translator that turned the web regular Expo code into web code. It could even be part of the normal Expo toolkit that wraps the iOS and Android. When the code is built it could recognize it’s going to the web and build accordingly. I’m not sure where NextJS or server rendering would come into this. You might need that for some IP level network calls, but for most applications I don’t see why it wouldn’t work entirely in the browser. Anyway I was just curious if it already existed. I’m not really a big react fan so learning react so I can build an application for Android and iOS is a lot of work for me. It would be nice if I didn’t have to maintain an entirely separate web application.

Wow RN overcoming React itself as a write once use everywhere code format… that would be something…!

1 Like

https://www.youtube.com/watch?v=8qCociUB6aQ

This is very interesting for my project and my companies project too. Therefore I’d like to contribute to this, if possible! I created this topic