Search code examples
reactjsexpo-router

expo-router will not switch between 2 basic pages - Expo Router


I have created a basic expo-router project with npx create-expo-app@latest --example with-router. I moved to typescript by adding the tsconfig.json. In my app folder I have 2 files, index.tsx and login.tsx.

export function App() {
  return (
    <>
      <Text>Index</Text>
      <Link href="/login">Login</Link>
    </>
  );
}

And

import { Text } from "react-native-paper";

export function Login() {
  return <Text>Login</Text>;
}

I am just wanting to navigate from the index.tsx to the login page. When I click the Link, I get an Unmatched Route page. I know this is supposed to be super simple, so what am I missing in my routing?


Solution

  • Pages are defined by exporting a React component as the default value from a file in the app directory.

    https://expo.github.io/router/docs/features/routing/