How to refresh page when web page is rotated?

I’m using Next JSs, I’m having trouble finding a solution how to refresh the page when it’s rotated

const app () => {

  useEffect(()=>{
  window.addEventListener("orientationchange", function() {
    window.location.reload()
  });})

   return(<>some code</>);
}