problem with html5 canvas can Not render rectangle when I have responsive width and height of canvas exlample is show in the code. if I delete responsive part of the code it renders rectangle but with it rectangle is not rendered and can not understand why
const canvas = document.querySelector('canvas')
const ctx = canvas.getContext('2d')
canvas.width = innerWidth
canvas.height = innerHeight - 100
ctx.strokeRect(50, 50, 50, 50);
// without this part of code it renders rectangle but with it rectangle is not rendered
window.addEventListener('resize', resizeWindow)
function resizeWindow() {
canvas.width = innerWidth
canvas.height = innerHeight - 100
}
resizeWindow()