I was doing the official Expo tutorial when I encountered a type error. I had a <Link> in my +not-found route that linked to the root directory. When I moved the routes into a route group called (tabs), the href gave this error:
Type '"/"' is not assignable to type"
Here is my +not-found.tsx:
import { View, StyleSheet } from 'react-native';
import { Link, Stack } from 'expo-router';
export default function NotFoundScreen() {
return (
<>
<Stack.Screen options={{ title: 'Oops! Not Found' }} />
<View style={styles.container}>
<Link href="/" style={styles.button}>
Go back to Home screen!
</Link>
</View>
</>
);
}
My root layout:
export default function RootLayout() {
return (
<Stack>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
</Stack>
);
}
There is an index.tsx file in the (tabs) folder, and at runtime everything runs with no problem.
Any help understanding what's happening would be appreciated.