-
Notifications
You must be signed in to change notification settings - Fork 0
Framework Best Practices
Using expo-router allows you to manage navigation with built-in abstractions instead of manually handling screen state. This follows React Native conventions, supports nested screens, back navigation, and deep linking, and avoids reinventing routing logic. Components used in expo router are the following: Stack, useRouter, Tabs, usePathname, Link, useFocusEffect, useLocalSearchParams, type {Href}
in frontend/app/(tabs)/_layout.tsx
import { Tabs, usePathname, useRouter } from "expo-router";
By using @/components/ui, we're taking advantage of a consistent, reusable set of prebuilt interface components across the application. This abstraction makes UI development easier since it provides the benefit of consistency in style, it avoids duplicated code, and it ensures visual consistency. The components utilize modern React Native design best practices and make developing interfaces faster. The components also prevent developers from having to build a UI component from scratch every time.
in frontend/app/(tabs)/dashboard.tsx
import { Badge, Button, Icon, Text } from "@/components/ui";
Using useWindowDimensions allows the UI to adapt dynamically to different screen sizes on web and mobile platforms. This avoids hardcoding dimensions, follows React Native best practices, and ensures consistent layouts across devices.
in frontend/hooks/use-breakpoint.ts
import { useWindowDimensions } from "react-native";