I'm using "react-d3-speedometer" library but getting the above error while importing. can anyone help with this?
1 Answer
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 })
1 Comment
Jamneck
Thanks for this answer! I had to make a slight adjustment to get it working for me:
... dynamic(() => import ("react-d3-speedometer" ...