@progress/sitefinity-nextjs-sdk
Version:
Provides OOB widgets developed using the Next.js framework, which includes an abstraction layer for Sitefinity communication. Additionally, it offers an expanded API, typings, and tools for further development and integration.
17 lines (16 loc) • 661 B
JavaScript
import { cache } from 'react';
function serverContext(defaultValue) {
if (cache) {
const getRef = cache(() => ({ current: defaultValue }));
const getValue = () => getRef().current;
const setValue = (value) => {
getRef().current = value;
};
return [getValue, setValue];
}
return [() => defaultValue, (v) => { }];
}
;
export const [getQueryParamsServerContext, setQueryParamsServerContext] = serverContext({});
export const [getHostServerContext, setHostServerContext] = serverContext('');
export const [getAdditionalFetchDataServerContext, setAdditionalFetchDataServerContext] = serverContext({});