T
TanStack•11mo ago
firm-tan

staticData on a lazy route

Hi, I want to make a breadcrumb component using useMatches and staticData on my routes. Everything is ok until I want to use lazy route with createLazyFileRoute which doesn't allow staticData to be passed. I would like to know if there's an alternative to using staticData to achieve what I want to do, or if I need to stay on non lazy routes.
4 Replies
optimistic-gold
optimistic-gold•11mo ago
if you want to use staticData, you need to create an additional createFileRoute for the same path, so foo.tsx and foo.lazy.tsx however, I would just enable autoCodeSplitting and don't use manual lazy routes
firm-tan
firm-tanOP•11mo ago
Oh so I can createFileRoute and use autoCodeSplitting?
optimistic-gold
optimistic-gold•11mo ago
yes
firm-tan
firm-tanOP•11mo ago
Thank you for the answer 🙂

Did you find this page helpful?