This page catalogs all the special exports One supports from route files.
_layout routes are special and do not support these exports unless
specified.A _layout route can export a SuspenseFallback component to show loading UI while one of its child routes is suspended. Nested layouts inherit the fallback, and the nearest layout export takes precedence.
import { ActivityIndicator, Text, View } from 'react-native'import { Stack, type SuspenseFallbackProps } from 'one'
export function SuspenseFallback({ params }: SuspenseFallbackProps) { return ( <View> <Text>Loading profile {params.id}...</Text> <ActivityIndicator /> </View> )}
export default function AppLayout() { return <Stack />}The component receives the suspended route module’s contextKey as route and its URL parameters as params. Route fallbacks are enabled by default on native. On web, set web.suspendRoutes to true in the One config to enable route Suspense boundaries.
This export is needed for “ssg” type pages that use dynamic path segments (for example, [id].tsx). At build-time, One will expand the id segment into multiple pages, using the values you return from generateStaticParams.
The entire function and export generateStaticParams will be removed at build-time and everything it depends on will be tree-shaken out of your client-side bundle.
You’ll need to return an array of objects, where the object keys match the name inside the brackets. As an example, we’ll use nested dynamic segments:
export async function generateStaticParams() { const blogPosts = await getAllBlogPosts()
return blogPosts.map((post) => { return { month: post.month, year: post.year, slug: post.slug, } })}If this function returned this:
;[ { month: 10, year: 2025, slug: 'some-slug', },]Then you’d generate one page at /blog/10/2025/some-slug.
Control how a route appears in the generated sitemap.xml. This export is only used when web.sitemap is enabled in your config.
// Customize sitemap entry for this routeexport const sitemap = { // Priority (0.0 to 1.0) - higher means more important priority: 0.8,
// How often the content changes changefreq: 'daily',
// Last modification date (optional) lastmod: '2024-12-15',}You can also exclude a route from the sitemap entirely:
export const sitemap = { exclude: true,}Available options:
| Option | Type | Description |
|---|---|---|
priority | number | Value from 0.0 to 1.0 indicating relative importance |
changefreq | string | One of: 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' |
lastmod | string | Date | Last modification date for this route |
exclude | boolean | Set to true to exclude this route from the sitemap |
Route-level exports override the defaults set in your config.
Edit this page on GitHub.