getSlotContent
Learn how to synchronously retrieve default slot content.
This function synchronously retrieves the default content for a Slot from the @croct/content package.
Lazy loading
When using bundlers that support code splitting, prefer the async counterpart over this function, as it enables lazy loading of content modules.
Signature
This function has the following signature:
getSlotContent(slotId: string, language?: string): JsonObject | nullThe return is the content as a JSON object, or null if no content is available for the given slot and locale.
Example
Here is a minimal example of how to use this function:
1234567
import {getSlotContent} from '@croct/content';
const content = getSlotContent('home-hero');
if (content !== null) { console.log(content.title);}Parameters
The following list describes the supported parameters: