How to migrate web apps from Next.js to Universal apps w/
@expo Router: A quick guide
This quick guide pinpoints just the core compatibility steps you need and that are already there for you to move to universal from web. Let's dive in!
Refactor UI from Tailwind to Nativewind
There are many styling libraries and setups out there, but the transition is smooth, and you get to reuse almost all Tailwind styles when translating styles from
@tailwindcss to Nativewind. It's fast because of the same stylings, and web developers are familiar with it, so the upgrades to Nativewind differences are minor.
I highly recommend
nativewind.dev because it is the de facto UI compatibility layer for migrating from Tailwind to universal platforms (web, iOS, Android). There is an important amount of styling you have already won that does not need changes and it's in place ready to use on
#reactnative components.
Refactor form Next.js pages router to Expo router
Next.js uses file-based routing, just like Expo Router. If you use something like
solito.dev, the solito router handles platform routing differences for you. However, if you choose Expo Router with Expo for web using metro bundler, the routing migration is doable. You have the useRouter and Link components, so it's about finding the differences in the API and applying them.
Refactor from Next.js API routes to Expo Router API routes.
Expo Router is WinterCG compliant, so that means all Next.js API routes can be ported with ease.
@t3dotgg showcases this on this vid timestamp.
piped.video/2P0q1EdH_oQ?si=gd8v…
Are we done yet? Not really. Porting an app needs some extras steps, but this is the core of it.
I did a port last year from Next.js to Expo so you can take a look at the source code for inspiration (
dub.sh/universalmedusa).
That's it. Happy universal (tele)porting!