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•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 routesfirm-tanOP•11mo ago
Oh so I can
createFileRoute and use autoCodeSplitting?optimistic-gold•11mo ago
yes
firm-tanOP•11mo ago
Thank you for the answer 🙂