LocationContext
LocationContext is a thin component that composes the app’s providers in the correct order so your components can rely on a fully-initialized environment: location resolution, auth, settings, and UI scaffolding. It also provides a Suspense fallback for data-driven providers.
Source: src/states/LocationContext.tsx
Composition order
src/App.tsx), the entire tree is wrapped by LocationByHostProvider before LocationContext is rendered. This guarantees host-level location is available before route-level overrides:
Responsibilities
- Provide a Suspense boundary (
<Preloader />) for data-loading providers. - Scope business context either by route param (via
LocationByRouteProvider) or fallback to host (viaLocationByHostProviderat the app root). - Ensure authentication, location settings, and modal system are available to children.
When to use
UseLocationContext to wrap your routed application. If you’re building a standalone view or micro-frontend, replicate the same provider order to guarantee consistent behavior.
Related hooks and providers
- useLocationByHostContext – Resolve business by host/domain
- useLocationByRouteContext – Override business by
:webAddress