DEV Community

Roberto Leibman
Roberto Leibman

Posted on

lazy load with http header?

Hey.... I'm working on an app, I want to lazy load a separate bundle, but want to make sure the lazy load contains a specific http header (a bearer token).

The reason for this question (in case I'm barking up the wrong tree) is that I want my login bundle to be publically accessible, but the main app to only be accessible once the login has been successful. Using React.lazy(() => import("./pages/Dashboard")); sounds promising, but I'm not sure if there's a way to add my header (I also looked at react-loadable.... same issue)

Top comments (0)