TX014

Used outside <AppRouter>

Console

Text.js error TX014: … must be used inside <AppRouter>. Run your app with `text dev`, or wrap it in <AppRouter routes={…}>.

Why this happens

useRouter, usePathname, useParams, useSearchParams, useAppTheme and <Link> read state that <AppRouter> provides. The component rendered outside of it, usually in a standalone renderToConsole call or a unit test.

How to fix it

Run the app with text dev, text start or text run, which mount <AppRouter> for you. When rendering by hand (tests, embeds), mount the router instead of the page:

import { AppRouter } from "@textjs/next/router";await renderToConsole(<AppRouter routes={routes} />);