SuperAPI AI 工具集

tanstack-start

前端与建站

查看项目

更新于 10-16 08:46

技能介绍

用途:为 TanStack Start 全栈 React 框架提供最佳实践指导,适用于使用 @tanstack/react-start@1.x、React 18.0+、TypeScript 5.0+、Vite 与 TanStack Router 的项目。

主要能力:按优先级覆盖规则类别,包括服务端函数(createServerFn、GET/POST)、中间件(createMiddleware、客户端/服务端执行与链式调用)、输入校验(Zod/Standard Schema 与信任边界)、流式 SSR 与 Suspense、按路由 head() 的 SEO 元信息、认证模式(beforeLoad 守卫、会话服务端函数、cookie 转发)、水合不匹配防护、静态预渲染与 ISR、API 路由、部署与项目配置。

必要用法:安装 npm install @tanstack/react-start @tanstack/react-router 与 npm install -D @tanstack/router-plugin;Vite 配置中接入 tanstackStart() 与 react() 插件;根路由使用 createRootRoute 并配合 HeadContent、Outlet、Scripts。服务端代码应使用 createServerFn,输入需经 inputValidator 校验;SEO 元信息通过路由 head() 定义;服务端渲染组件中不可访问 window/document,改用 useEffect 处理仅客户端状态。认证守卫可在 beforeLoad 中校验并重定向。

适用场景:需要 SSR/流式渲染、SEO、认证与部署配置的 TanStack Start 全栈 React 应用。

限制:资料未提供具体收费、价格或效果数据;部分高级主题未在资料中展开,暂未提供。