useRouteData
Describes@ebitex/content-sdk 1.xSee the changelog:@ebitex/content-sdk
useRouteData<
TDefinition>(definition):RouteDataState<RouteDataOf<TDefinition>>
The data a route-bound loader fetched for this page. Every section that calls it with the same definition shares one load, however many there are.
const person = useRouteData(personData)if (person.status === 'loading') return <Skeleton />if (person.status === 'ready') return <h1>{person.value.name}</h1>return null // 'notFound': the page is already drawing the site's not-founddefinition must be one of the list given to <Experience routeData>; anything else throws.
When the page has a route whose tag is not the definition’s (or has none), reading it throws in
development, naming both tags; in production it reports notFound. On a page with no route it
reports notFound in both modes. Listing a definition no section reads on such a page is fine.
Type Parameters
Section titled “Type Parameters”TDefinition
Section titled “TDefinition”TDefinition extends AnyRouteDataDefinition
Parameters
Section titled “Parameters”definition
Section titled “definition”TDefinition
Returns
Section titled “Returns”RouteDataState<RouteDataOf<TDefinition>>