Files
SnowLuma/.pnpm-store/v11/files/ef/3219a463df69f2bc03491eb7cc3b9b9d624e2ca1731018ebb6eb6182ee575474760f8d396201f7ec91a38669d4ef2499629085f4cd766f6c444375cfcd5859
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

18 lines
502 B
Plaintext

import { useStore } from '@tanstack/react-store'
import { isServer } from '@tanstack/router-core/isServer'
import { useRouter } from './useRouter'
export function useCanGoBack() {
const router = useRouter()
if (isServer ?? router.isServer) {
return router.stores.location.get().state.__TSR_index !== 0
}
// eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static
return useStore(
router.stores.location,
(location) => location.state.__TSR_index !== 0,
)
}