T
TanStack12mo ago
rare-sapphire

Retrieve some routes from all flatRoutes

Hello, I would like to retrieve some routes with a precise staticData. Could you please tell me how to do that? For the moment, I'm trying to retrieve the flatRoutes from the useRouter method, then trying to apply a match but doesn't succeed.. Thanks!
1 Reply
national-gold
national-gold12mo ago
It should be as simple as filtering from the flatRoutes.
const router = useRouter();
router.flatRoutes.filter(r => myConditionCheck(r.options.staticData))
const router = useRouter();
router.flatRoutes.filter(r => myConditionCheck(r.options.staticData))
From there on, its just a matter of performing your filter.

Did you find this page helpful?