-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReferenceError: window is not defined #461
Comments
@swastkk are you running this from a Next JS app or is it a React SPA. |
I am working on NextJS |
@swastkk have you tried running the app with the use client directive |
Yes, I tried that and it doesn't work. The reason is that nextjs pre-renders client components on server as well. So even if it's marked as |
@KarsonJo Hey, so did you find any solution ?? |
@SaiRev0 Sorry, I didn't find it, only a workaround. // react-chrono-client.ts
"use client"
import type { Chrono as ChronoType } from "react-chrono";
import dynamic from 'next/dynamic'
export const Chrono = dynamic(() => import('react-chrono').then(lib => lib.Chrono), {
ssr: false,
}) as typeof ChronoType |
@KarsonJo what u did here can u help me to understand ? i want to render chrono component at client side.. |
@Milan-Bhingradiya |
thanks this worked for me 👍🏻 |
While running
Getting this error
The text was updated successfully, but these errors were encountered: