Answers for "next js windows undefined"

0

next js windows undefined

// 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
Posted by: Guest on June-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language