Navigation Menu

Skip to content
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 #21

Open
konsumer opened this issue Mar 25, 2022 · 0 comments
Open

ReferenceError: window is not defined #21

konsumer opened this issue Mar 25, 2022 · 0 comments

Comments

@konsumer
Copy link

I am trying to use react-charts-d3 in a SSR remix app (on cloudflare workers) and I get this error.

Normally I can do somthign like this to force a graphing library to only work in browser:

import { LineChart } from 'react-charts-d3'

export default function ChartLineMine ({ data }) {
  if (typeof window === 'undefined') {
    return null
  }
  return (
    <LineChart data={data} />
  )
}

I think there must be a top-level use of window or something, because it happens even if I don't return LineChart (just importing the library.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant