https://zenn.dev/no4_dev/articles/878f4afbff6668d4e28a-2

// リサイズ イベント
//=====================================================
const mqlSP = window.matchMedia('(max-width:767px)')
const mqlTablet = window.matchMedia('(min-width:768px) and (max-width:1023px)')
const mqlPC = window.matchMedia('(min-width:1024px)')

mqlSP.addEventListener('change', ev => {
  if (ev.matches) {
    // sp用
    console.log('sp用ブレークポイント用処理');
    window.location.reload();
  }
})
mqlTablet.addEventListener('change', ev => {
  if (ev.matches) {
    // tablet用
    console.log('tb用ブレークポイント用処理');
    window.location.reload();
  }
})
mqlPC.addEventListener('change', ev => {
  if (ev.matches) {
    // pc用
    console.log('pc用ブレークポイント用処理');
    window.location.reload();
  }
})