Reputation: 100
I'm using "react-d3-speedometer" library but getting the above error while importing. can anyone help with this?
Upvotes: 2
Views: 4490
Reputation: 98
This is because NextJS tries to do the server-side rendering and they are components that depend on the browser.
you can fix this by using dynamic import disabling server-side rendering:
import dynamic from 'next/dynamic'
const ReactSpeedometer = dynamic(import ("react-d3-speedometer"), { ssr: false })
Upvotes: 4