withCroct
Enable dynamic content for Storyblok.
This function connects the Storyblok SDK to Croct to enable automatic dynamic content for personalization and AB testing. It is the entry point for the JavaScript family of SDKs.
It intercepts Storyblok API calls and replaces content that references slots with dynamic content. In the Storyblok visual editor, dynamic content is automatically bypassed so editors always see the original content.
Signature
JavaScript
function withCroct(options: SbSDKOptions): SbSDKOptionsExample
JavaScript
12345678
import {storyblokInit, apiPlugin} from '@storyblok/js';import {withCroct} from '@croct/plug-storyblok/js';
storyblokInit(withCroct({ accessToken: 'YOUR_ACCESS_TOKEN', use: [apiPlugin], components: {},}));Platform imports
The following table lists the import path for each supported platform:
| Platform | Import path |
|---|---|
| JavaScript | @croct/plug-storyblok/js |
| React | @croct/plug-storyblok/react |
| Next.js | @croct/plug-storyblok/next |
| Vue | @croct/plug-storyblok/vue |
| Nuxt | @croct/plug-storyblok/nuxt |