From 69e35f313f14482e7e14e4f2a82719dc5f807cb1 Mon Sep 17 00:00:00 2001 From: sorrycc Date: Mon, 11 Nov 2024 16:57:09 +0800 Subject: [PATCH] docs: add FAQ to README.md --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 3e8faa0..18accf0 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,19 @@ Config is loaded from `.tnfrc.ts` by default. - `less: { modifyVars?: Record; globalVars?: Record; math?: 'always' | 'strict' | 'parens-division' | 'parens' | 'strict-legacy' | number; sourceMap?: any; plugins?: (string | [string, Record])[];}`: The configuration passed to lessLoader. - `router: { defaultPreload?: 'intent' | 'render' | 'viewport'; defaultPreloadDelay?: number; devtool?: { options?: { initialIsOpen?: boolean; position?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' }; } | false }`: The router configuration. +## FAQ + +### How to specify a redirect route? + +You can use `redirect` function in loader to specify a redirect route. + +```tsx +import { redirect, createFileRoute } from '@umijs/tnf/router'; +const Route = createFileRoute('/foo')({ + loader: async () => redirect({ to: '/bar' }), +}); +``` + ## LICENSE [MIT](LICENSE)