As knows NextJS
is using the server side rendering, I want to use SurveyJs
with it but surveyJS
is using some function that must be executed in client side. In my case I wanna use StylesManager.applyTheme
but it throws an server error of ReferenceError: document is not defined
any possible way can I use to execute the applyTheme
function in client side?
For better implementation, I solved the issue using dynamic imports from NextJs
Instead, I imported my SurveyComponent
like this:
const SurveyComponent = dynamic(
() => import("../../../../components/survey/PartOne"),
{
ssr: false,
}
);
To make sure my SurveyComponent
does not render on server-side.