next js referenceerror window is not defined

// try this for solved this issue

// components teritory
function Alert() {
  return <div>{window.confirm('apakah anda belum makan ?') ? window.alert('ya') : window.alert('sudah')}</div>
}

export default Alert


// pages teritory
import dynamic from 'next/dynamic'

const AlertView = dynamic(() => import('../components/Alert'), { ssr: false })

function Alert() {
	return (
		<div>
			<AlertView />
		</div>
	)
}

export default Alert

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
next js referenceerror window is not defined NextJS Server Error ReferenceError: window is not defined window is not defined next js import next.js ReferenceError: window is not defined window not defined error in next.js window not defined next js next js Server Error ReferenceError: window is not defined fix window is not defined nextjs nextjs 11 window is not defined ReferenceError: window is not defined next referenceerror window is not defined next js when importing referenceerror window is not defined nextjs when importing ReferenceError: window is not defined in next Server Error ReferenceError: window is not defined next js ReferenceError: window is not defined in nextjs ReferenceError: window is not defined nextjs server side referenceerror window is not defined in next wrapper reactjs nextjs window not defined window is not defined next js draft js react window is not defined nextjs how to fix window is not defined in nextjs window not defined nextjs window is not defined nextjs how to fix it on next.js window is not defined next.js window is not defined ReferenceError: window is not defined next js nextjs ReferenceError: window is not defined nextjs window is not defined window is not defined in nextjs referenceerror window is not defined nextjs next js ReferenceError: window is not defined referenceerror: window is not defined nextjs window is not defined next js next js window not defined window is not defined next window is not defined in next js next js window is not defined
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source