2

I'm using "react-d3-speedometer" library but getting the above error while importing. can anyone help with this?

1

1 Answer 1

4

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 })
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for this answer! I had to make a slight adjustment to get it working for me: ... dynamic(() => import ("react-d3-speedometer" ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.